PortDock

Reading Modbus floats and 32-bit values — finding the word order

Float32 and U32 values span two registers, and which comes first is up to the device. Find ABCD or CDAB with a known value; see what wrong orders look like.

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).

Order25.0 (float32)100000 (U32)Common name
ABCD41C8 00000001 86A0Big-endian — high word first
CDAB0000 41C886A0 0001Word swap — low word first
BADCC841 00000100 A086Byte swap
DCBA0000 C841A086 0100Little-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 asfloat32U32
ABCD251103626240
CDAB2.36 × 10⁻⁴¹16840
BADC−1976323359703040
DCBA7.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

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

Published 2026-10-22