User manual
Modbus TCP Specification 22 (46)
5 Modbus TCP Specification
The Modbus protocol is a single master protocol. The Modbus TCP client (master) controls the
entire communication, and the connected Modbus TCP servers (slaves) are only allowed to
respond to its requests. The Anybus M-Bus to Modbus-TCP gateway is a Modbus TCP server.
Modbus TCP communication requires an established connection between the servers and the
client over a specified TCP port. If there is a network firewall between the servers and the client,
the specified TCP port must be opened in the firewall. The default port number is 502.
5.1 Function Codes
Supported Modbus Function Codes
Code Name
Description
0x01 Read Coil Not used
0x03 Read Holding Register Reading of meter data
0x05 Write Single Coil Not used
0x06 Write Single Register Not used
0x10 Write Multiple Register Not used
0x0F Force Multiple Coil Not used
0x2B Read Device Identification Reading of device data by MEI = 0x0E
Function codes marked “Not used” are replied with ILLEGAL DATA ADDRESS (0x02). Other
unsupported codes are replied with ILLEGAL FUNCTION (0x01).
If the function code 0x2B (Read Device Identification) is used with MEI=0x03, the gateway will
respond with identification data. The values 0x01 and 0x02 are supported as Device ID code,
allowing to retrieve basic and regular device identification data.
Identification Data
Code Name Data type 20 UL model 80 UL model Type
0x00 VendorName String HMS Industrial Networks AB Basic
0x01 ProductCode String 1 2 Basic
0x02 MajorMinorRevision String 001 Basic
0x03 VendorUrl String www.anybus.com Regular
0x04 ProductName String Anybus M-Bus to Modbus-TCP Gateway Regular
0x05 ModelName String Standard Regular
0x06 UserApplicationName String Anybus M-Bus to
Modbus-TCP 20
Anybus M-Bus to
Modbus-TCP 80
Regular
5.2 Data Format
The arrangement of data in the Modbus registers corresponds to the usual structure. It uses big
endian representation. For the 16 bit registers, the higher byte is sent first, then the lower byte.
Example: value: 0x1234 transmission order: 0x12, 0x34
If number and data ranges go beyond 16 bits, representation is similar. Again, the most
significant 16 bit register is sent first and is addressed with the lowest register address.
Example: value: 0x12345678 transmission order: 0x12, 0x34, 0x56, 0x78
The byte order of 32 bit and 64 bit values can be changed within the system configuration file by
setting the parameter MODBUS_SWAP, see Configuration Files, p. 39.
M-Bus to Modbus-TCP Gateway User Manual SCM-1202-0096-EN 2.1