CHAPTER 2: MODBUS COMMUNICATION
The ADU is described as follows.
Table 2-2: Modbus TCP/IP format
MBAP header — This Modbus Application Protocol header contains the following fields:
Transaction Identifier: Used for transaction pairing. The Modbus server copies in the response the transaction
identifier of the request.
Protocol Identifier: Used for intra-system multiplexing. The Modbus protocol is identified by the value 0.
Length: The length field is a byte count of the following fields, including the Unit Identifier and data fields.
Unit Identifier: For the purposes of the UR, this field is equivalent to the Modbus RTU SLAVE ADDRESS field. The
client must use the same value here as programmed in the UR setting
FUNCTION CODE — This is the same as the Modbus RTU function code field described above.
DATA — This is the same as the Modbus RTU data field described above.
2.1.5 Modbus RTU CRC-16 algorithm
The Modbus TPC/IP CRC-32 algorithm is universally executed in hardware, so there is no need to describe it here.
The Modbus RTU CRC-16 algorithm essentially treats the entire data stream (data bits only; start, stop and parity ignored)
as one continuous binary number. This number is first shifted left 16 bits and then divided by a characteristic polynomial
(11000000000000101b). The 16-bit remainder of the division is appended to the end of the packet, MSByte first. The
resulting packet including CRC, when divided by the same polynomial at the receiver will give a zero remainder if no
transmission errors have occurred. This algorithm requires the characteristic polynomial to be reverse bit ordered. The
most significant bit of the characteristic polynomial is dropped, since it does not affect the value of the remainder.
A C programming language implementation of the CRC algorithm can be provided upon request.
Table 2-3: Modbus RTU CRC-16 algorithm
16 bit working register
low order byte of A
high order byte of A
16 bit CRC-16 result
logical EXCLUSIVE-OR operator
total number of data bytes
i-th data byte (i = 0 to N-1)
16 bit characteristic polynomial = 1010000000000001 (binary) with MSbit dropped and bit order reversed
right shift operator (th LSbit of x is shifted into a carry flag, a '0' is shifted into the MSbit of x, all other bits
are shifted right one location)
UR FAMILY – COMMUNICATIONS GUIDE
MODBUS RTU PROTOCOL
MODBUS SLAVE ADDRESS