Overview
Byte order, or endianness, defines how bytes are arranged inside a multi-byte value. In industrial protocols such as Modbus, this matters any time a value is larger than 8 bits.
The practical reason this deserves its own reference page is simple: many field issues described as scaling problems or bad data are actually byte-order or word-order mismatches.
Big-Endian Vs Little-Endian
| Order | Byte Layout (16-bit) | Also Called |
|---|---|---|
| Big-endian | Most significant byte first | Network byte order |
| Little-endian | Least significant byte first | Intel byte order |
For a 16-bit value 0x0102:
- Big-endian:
01 02 - Little-endian:
02 01
Byte Order Vs Word Order
For 32-bit and 64-bit values spanning multiple registers, there are two separate ordering decisions:
- Byte order inside each 16-bit word
- Word order across the 16-bit words
That is why one device can expose a perfectly valid FLOAT32 value that still looks wrong unless both byte and word order are configured correctly.
How To Diagnose It
- Read the raw value from the device.
- Decode the value using the plausible byte and word-order combinations.
- Compare the decoded result to a known physical measurement.
- Keep the combination that matches the real-world value.
Common Problems
- 32-bit float looks wildly wrong even though the address is correct
- Value only makes sense when registers are reversed
- Scaling is blamed when the real fault is byte or word order