A Modbus register is 16 bits and its two bytes travel high byte first (Modbus Application Protocol V1.1b3, 4.2 «big-Endian»). A 32-bit integer (U32, S32) or an IEEE 754 float32, however, spans two registers — a float64 four — and the specification does not say which half goes into which register. The same value therefore arrives in different orders from different devices.
Four orders
Call the value's bytes A, B, C, D from most to least significant. Across two registers (lower address first) there are four layouts. Here they are for 25.0 (float32 = 0x41C80000) and the integer 100000 (0x000186A0).
| Order | 25.0 (float32) | 100000 (U32) | Common name |
|---|---|---|---|
| ABCD | 41C8 0000 | 0001 86A0 | Big-endian — high word first |
| CDAB | 0000 41C8 | 86A0 0001 | Word swap — low word first |
| BADC | C841 0000 | 0100 A086 | Byte swap |
| DCBA | 0000 C841 | A086 0100 | Little-endian |
What a wrong order looks like
Decoding the registers «41C8 0000» four ways gives 25 only for the right order (ABCD); the others are nonsense.
| Decoded as | float32 | U32 |
|---|---|---|
| ABCD | 25 | 1103626240 |
| CDAB | 2.36 × 10⁻⁴¹ | 16840 |
| BADC | −197632 | 3359703040 |
| DCBA | 7.18 × 10⁻⁴¹ | 51265 |
Values extremely close to zero (below 10⁻³⁸), absurdly large values or flipped signs point to the order first. Even a plausible-looking value is not settled until it matches the front panel.
Finding the order
- 1. Pick a register pair whose value you know — a value on the front panel or a setpoint you wrote yourself. A fixed value is easier to compare than a changing measurement.
- 2. Read both registers in one request from the value's start address. Two separate reads can catch the value changing in between, so the halves mismatch.
- 3. Decode it in all four orders and keep the one that matches the front panel.
- 4. If all four look wrong, suspect the address. A start address off by one mixes the second half of the previous value with the first half of this one — check 0-based, 1-based and 40001 notation first.
- 5. Before applying the order to other 32-bit values, check that the manual does not list different orders per value.
Words to look for in the manual
Manuals say «Big-Endian», «high word first», «word swap» or «little-endian word». The Rootech Accura 3300E manual states that 32-bit values are big-endian with the high word at the lower address (p.19). The LS ELECTRIC GIMAC1000 switches between ABCD (100.0 → 42C8 0000) and CDAB (0000 42C8) with its Swap setting (user manual p.42). Since a setting can change the order, confirm it once with a value you read.
Float32 precision
A float32 has a 24-bit significand, about 7 significant digits. 123.456 stored as float32 reads back as 123.456001 — the device is not wrong. For values with many digits, devices may use float64 (four registers) or a U32 integer with a scale factor. Float64 works the same way: check the order of all four registers.
In PortDock
- «Modbus Float Converter» web tool: enter 2 or 4 registers to see float32, float64 and int32 in ABCD, CDAB, BADC and DCBA side by side, or convert a value to registers.
- Modbus Master: set U32, S32, F32 or F64 and the order per cell. Put a cell with a known value on F32 and switch orders until the value makes sense.
- Modbus Slave: «Fill example values» puts F32 CDAB 23.5 into holding registers 8–9, so you can check a master's order setting without a device.
Published 2026-10-22