PET-AR400 User Manual
V1.0.0
P.52
5.1.
Modbus/TCP Interface
Modbus TCP/IP uses port 502 to listen and receive Modbus messages over Ethernet.
5.2.
Modbus/TCP Data Frame
The complete Modbus/TCP ADU (Application Data Unit) is embedded into the data field of a
standard TCP frame and sent via TCP on port 502. The Modbus/TCP ADU is shown below.
Modbus/TCP ADU (Application Data Unit)
Transaction ID
2 bytes
Protocol ID
2 bytes
Length
2 bytes
Unit ID
1 byte
Function Code
1 byte
Data
n bytes
MBAP Header (Modbus Application Header)
PDU (Protocol Data Unit)
MBAP Header
The MBAP is a 7-byte header that contains the following information:
Transaction ID
Protocol ID
Length
Unit ID
2 bytes
2 bytes
2 bytes
1 byte
byte 0 ~ 1
byte 2 ~ 3
byte 4 ~ 5
byte 6
Transaction ID
:
2 bytes are set by the Master to uniquely identify each request.
Protocol ID
:
2 bytes are set by the Master, will always be 00 00, which corresponds to the Modbus
protocol.
Length
:
2 bytes are set by the Master, identifying the number of bytes in the message that follow.
It is counted from Unit Identifier to the end of the message.
Unit ID
:
1 byte is set to Master. It is repeated by the Slave device to uniquely identify the Slave
device. Availed unit identifier is in the range of 0 to 247. Unit identifier 0 is used for general
broadcast, while unit identifier 1 to 247 is given to individual Modbus devices.