MODBUS · IEEE-754 32-BIT REAL

Modbus 32-Bit Float Word & Byte Swap Calculator

Paste two 16-bit Holding Registers to decode all 4 endian combinations (ABCD, CDAB, BADC, DCBA) side-by-side, or encode any REAL value into hex/integer register pairs.

Incoming 16-Bit Holding Registers

Enter hex (0x42F6, 16#42F6) or decimal (0–65535 or signed -32768..32767)

ABCDBig-Endian (No Swap)
-2.718449e+23
Bytes: [E6 66 42 F6]
Network Byte Order, ABB, Honeywell
CDABWord-Swapped (Mid-Little-Endian)Likely Match
123.45
Bytes: [42 F6 E6 66]
Modicon / Schneider, Rosemount, Endress+Hauser
BADCByte-Swapped Within Words
5.453435e+23
Bytes: [66 E6 F6 42]
Legacy Serial Gateways, Byte-Swapped Links
DCBALittle-Endian (Full Byte Reverse)
-9.857350e+32
Bytes: [F6 42 66 E6]
x86 / ARM Native Little-Endian Buffers

Studio 5000 Structured Text Word-Swap Pattern

// Reassemble CDAB (Low-Word First) INT[2] into Studio 5000 REAL:
SwapBuf[0] := MbReadData[1]; // Move High Word
SwapBuf[1] := MbReadData[0]; // Move Low Word
COP(SwapBuf[0], FlowRate_REAL, 1);

Frequently Asked Questions

Why does my Modbus 32-bit float read as a huge exponent like -1.23e+32 in the PLC?+

Modbus only defines 16-bit registers and never standardized which 16-bit word comes first in a 32-bit IEEE-754 REAL. If the field meter sends Low-Word first (CDAB) and the PLC copies High-Word first (ABCD), the mantissa bits land inside the 8-bit exponent field, producing wild scientific-notation numbers.

How do you fix Word Swap (CDAB) in Studio 5000 ControlLogix or CompactLogix?+

Copy or map the two incoming INT registers in reverse word order into a scratch INT[2] array (Scratch[0] := Modbus_Reg[1]; Scratch[1] := Modbus_Reg[0]) and then execute COP(Scratch[0], Target_REAL, 1), or use the SWPB (Swap Bytes) instruction with WORD mode.

What is the difference between CDAB and BADC byte order?+

Assuming ABCD is standard Big-Endian [ByteA, ByteB, ByteC, ByteD]: CDAB swaps the two 16-bit registers without changing byte order inside each word, whereas BADC keeps word order intact while reversing High and Low bytes inside each 16-bit register.

Does a 1-offset register shift (+1 address) cause bad float values too?+

Yes! Reading 40001–40002 instead of 40000–40001 (0-based vs 1-based Modbus addressing) pairs half of one float with half of the next register. If none of ABCD, CDAB, BADC, or DCBA match your expected process reading, shift your starting Modbus address by +1 or -1.

12 Free Browser-Based Engineering Utilities

Complete PLC & Industrial Automation Calculator Suite