For more information on MODBUS, visit: www.modbus.org.
6.1 Endian Order and Byte Packing
MODBUS transfers data in units of bits and registers. The AquaVent only uses MODBUS functions that operate on registers. A MODBUS register contains 16 bits.
MODBUS always transfers data in Big Endian, or Network order, regardless of the architecture of the system that is accessing the MODBUS. Normally the MODBUS protocol stack is compiled for the target system in such a way that it does whatever conversion is needed to move data properly between the application layer and the MODBUS. MODBUS always moves multiple registers over the communication line in ascending order of register address, and within each register the octets (bytes) are moved in order of descending arithmetic significance.
Floating point data types such as IEEE-754 will have their octets (bytes) ordered by significance in the same way as integers. This is also true in most modern systems (both big-endian and little-endian).
Examples: (all three examples use the same register data). Unicode String (UTF-8 encoding) "21º" or int32 0x3231C2B0, or IEEE-754 sign*(mantissa/2^23+1)*2^(exp-127) = decimal +1.388753891*2^-27 = +1.034702279e-8 |
|||||
Unicode string (UTF-8) | 0x32 ('2') | 0x31 ('1') | 0xC2B0 ('°') | ||
Byte Values | 0x32 | 0x31 | 0xC2 | 0xB0 | |
Byte Significance (Transmission Order) | High (First) | Low | High | Low (Last) | |
Register Address (Transmission Order) | n+0 (First) | n+1 (Last) | |||
MODBUS Register Value | 0x3231 | 0xC2B0 | |||
Register Value (decimal) | 12849 | 49840 (or -15696 if signed) | |||
Binary | 0011 0010 | 0011 0001 | 1100 0010 | 1011 0000 | |
IEEE-754 constituents | Sign | Exponent (base 2, biased by +127) | Mantissa (parts per 2^23, 1<=norm.<2, less 1) | ||
IEEE-754 binary values | 0 | 011 0010 0 | 011 0001 1100 0010 1011 0000 | ||
IEEE-754 decimal equiv. | + | 100 | 3261104 | ||
IEEE-754 un-biased and/ or de-normalized | + | -27 | 1.388753891 |