Modbus Float Converter (IEEE 754, Two Registers)
Turn two Modbus registers into a 32 bit floating point value, and see the result for every byte and word order at once, so you can spot the right one immediately.
- Bytes in order ABCD are assembled into a big endian 32 bit word, then read as IEEE 754 single precision.
Same registers in every byte order
| Order | Float | Unsigned 32 bit |
|---|---|---|
| ABCD | 123.456 | 1123477881 |
| CDAB | −1.883367 × 10^+25 | 3917038326 |
| BADC | −9.861115 × 10^+32 | 4131551721 |
| DCBA | 1.518500 × 10^+35 | 2045376066 |
How a Float Fits in Two Registers
ABCD: register 1 = A B, register 2 = C D · CDAB: register 1 = C D, register 2 = A B
Modbus defines 16 bit registers only, so each manufacturer chooses how to place the 4 bytes of a float. Word swapped (CDAB) is very common in PLCs and meters.
Worked example
123.456 is 0x42F6E979. In ABCD order register 1 = 0x42F6 and register 2 = 0xE979; a CDAB device sends 0xE979 first.
Frequently Asked Questions
What is CDAB byte order?
Word swapped: the low word is sent in the first register and the high word in the second.
Why does my Modbus float show a strange value?
Usually the word or byte order is wrong, or the two registers are not aligned (reading from an odd address).
How many registers does a float use?
Two 16 bit registers for a 32 bit float; four for a 64 bit double.
Learn more on the blog
Modbus protocol explained: RTU vs TCP
A practical, field focused guide on instrumentationblog.in that explains the theory behind this tool and how engineers apply it on real plants.
Read Full Article