Reads device identification information from a MODBUS slave and returns as a String value.
... modbus_object.ReadDeviceId(object_id)
Prerequisites
None
Parameters
object_id
A required Integer expression that evaluates to a number from 0 to 255 that selects the identification information to be returned.
Remarks
This method issues a MODBUS Read Device Identification request (MEI-type 13) using the Encapsulated Interface Transport (function 43) to retrieve identification information from the slave. The Read Device ID code is always set to 1.
The object_id parameter selects the identification information to be returned. Some standard values are shown in Table 19-67:
Object ID | Description |
---|---|
0 |
Vendor name |
1 |
Product code |
2 |
Major and Minor Revision |
Consult the MODBUS/TCP standard for the meaning of other object_id values.
Not all MODBUS devices support this function. The String value returned by this method depends on the particular device being referenced. Consult the manual for your MODBUS slave device for details.
A new connection to the MODBUS slave is made if none currently exists.
If any network errors occur, this method throws an exception.
Examples
Dim ep As New IPEndPoint("192.168.0.150")
Dim mb As New Modbus(ep)
Dim id As String
id = mb.ReadDeviceId(0) ' Read vendor name
See Also