A Modbus register holds 16 bits, so a float or a 32-bit integer spans two of them, and devices disagree about the order. Enter the two registers and see the value in every order at once; the right one is usually obvious.
Call the four bytes A B C D, most significant first, as IEEE 754 defines them. The Modbus standard fixes the byte order inside a register (big-endian) but says nothing about which register comes first, and some devices also swap the bytes.
ABCD is big-endian throughout. CDAB swaps the two registers, which is the most common alternative and is often called word swap. BADC swaps the bytes inside each register. DCBA reverses everything.
Read a value you know, such as room temperature or a setpoint, and pick the order that gives it. Then set that order once in the system reading the device. The datasheet should state it, and often does not.
The device sends the low 16 bits of the value in the first register and the high 16 bits in the second. The bytes inside each register stay in normal order.
Almost always the wrong word order. A small float read with its registers swapped lands in the denormal range or far out of scale. Try the other orders.
As two's complement: a register above 32767 is negative, so 0xFF9F is -97. Many sensors send a value multiplied by 10 or 100, so -97 may mean -9.7.
Genesis reads RS485 Modbus sensors, analogue transducers and 1-Wire probes on the same four ports and reports them over cellular. Tell us what you need to read.
Talk to us →