Modbus Showing Wrong Values? It's the Byte Order

TROUBLESHOOTINGUpdated Feb 202612 min read

Your Modbus communication is working — you're getting responses, no exceptions, no timeouts. But the values make no sense. Voltage reads as 2.84×10⁻²⁹ instead of 236.4V. Power shows 1.23×10³⁸ instead of 150kW. This is almost always a byte order (endianness) problem.

Why This Happens

A Modbus register is 16 bits (2 bytes). But a FLOAT32 (IEEE 754) value needs 32 bits — two consecutive registers. The Modbus specification says each 16-bit register is big-endian (high byte first). But it says nothing about how to order the two registers relative to each other. So manufacturers choose their own convention.

The same 4 bytes — say 0x43 0x6C 0xC2 0x8F — produce completely different float values depending on the order you read them:

Byte Order ComparisonSame 4 bytes, 4 different results
Raw bytes: 43 6C C2 8F ABCD (Big Endian): 236.7603 ← Correct! CDAB (Word Swap): -97.1318 BADC (Byte Swap): 3.50177e+22 DCBA (Little Endian): -7.27869e+33
🔥 The Key Insight

If your value looks like a wild exponential number (10²⁰, 10⁻³⁰, etc.) but you expected something mundane like 236.4V, the byte order is wrong. The bytes are correct, the interpretation is wrong.

The 4 Byte Orders Explained

ABCD — Big Endian (Modbus standard)

Register 1 contains the high word (AB), Register 2 contains the low word (CD). This is the "natural" Modbus order and is used by ABB, many Schneider devices, and most devices that claim "Modbus compliant".

CDAB — Big Endian Word Swap

Register 1 contains the low word (CD), Register 2 contains the high word (AB). Each word's internal byte order is still big-endian, but the words are swapped. This is very common — Siemens and some older Schneider devices use this.

BADC — Little Endian Byte Swap

Register 1 contains the high word but with bytes swapped (BA), Register 2 contains the low word with bytes swapped (DC). Less common but found in some niche devices.

DCBA — Little Endian

Everything reversed. Register 1 = DC, Register 2 = BA. Found in some devices that store data in native Intel byte order.

How to Identify the Correct Byte Order

Read a value you can verify physically (voltage with a multimeter is ideal). Read the raw register values in hex. Then try all 4 interpretations using our Modbus Number Converter — one of them will give you the expected value.

Common Device Byte Orders

Fix It in Your Code

Once you know the byte order, configure your Modbus master to use it. In Ignition, this is set per device in the Modbus driver configuration. In PLCnext Structured Text, you'll need to swap the word order manually after reading the raw registers:

IEC 61131-3 STWord swap for CDAB byte order
// Raw registers from Modbus read wReg1 := awModbusData[0]; // First register (low word in CDAB) wReg2 := awModbusData[1]; // Second register (high word in CDAB) // Swap words: combine as high:low instead of low:high dwCombined := SHL(WORD_TO_DWORD(wReg2), 16) OR WORD_TO_DWORD(wReg1); // Cast to REAL (FLOAT32) rVoltage_L1 := DWORD_TO_REAL(dwCombined);
🔄 Byte Order

Compare all four byte order interpretations side-by-side

ModBus Pro shows ABCD, CDAB, BADC, and DCBA interpretations simultaneously for any register value. No more guessing — just pick the one that matches your expected reading. The Converter tool on this site also lets you test all 4 orders instantly.

Download Free