Hach ANATEL PAT700 User Manual - 11.3 Data Encoding
Page 149
Modbus Protocol
11.3 Data encoding
Modbus uses a 'big-endian' representation for addresses and data items. This means
that when a numerical quantity larger than a single byte is transmitted, the MOST
significant byte is sent first. The following sub-topics describe the different types of
encoding and show how the data is encoded as it is within the Modbus/TCP packet. Most
client drivers will extract the data from the packet in the correct format for use/display
within the client environment.
Binary
A binary item is represented as a single bit within a data word. All binary data is packed
in to 16-bit data words, which are accessed using FC3 therefore, a single register
contains 16 bits of binary data, each having a specific meaning.
Example (Decimal value): 43,605
16-bit Word (short)
A 16-bit word item is transmitted with the MOST significant byte first. FC3 reads 16-bit
items at a time; therefore, each of these data items will fit within one register that is read.
Example (Decimal value): 4,660
32-bit Word (int)
A 32-bit word item is transmitted with the MOST significant byte first, then the next MOST
significant, until all the bytes are transmitted. FC3 reads 16-bit items at a time; therefore,
two registers are required to read each 32-bit data item.
Example (Decimal value): 305,419,896
Value (Hex)
1st Register
2nd Register
0xAA55
0xAA
0x55
(101010100101)
(10101010)
(01010101)
Value (Hex)
1st Register
2nd Register
0x1234
0x12
0x34
1st Register
2nd Register
Value (Hex)
1st
2nd
1st
2nd
0x12345678
0x12
0x34
0x56
0x78