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)
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.
Complete PLC & Industrial Automation Calculator Suite
Bitwise & Data Formats
Simulate 16-bit INT and 32-bit DINT Masked Move instructions bit-by-bit with clickable mask gates and Structured Text output.
Decode or encode two 16-bit Holding Registers across all 4 endian byte orders (ABCD, CDAB, BADC, DCBA) for 32-bit REAL floats.
Convert between 16/32-bit Binary-Coded Decimal (BCD) thumbwheel words and integer values with invalid A–F nibble fault detection.
Analog I/O & Sensors
Convert raw ADC counts (4000–20000, 6241–31206, 0–27648) and 4–20 mA signals into engineering units with 5-point calibration tables.
Bidirectional Callendar–Van Dusen (°C/°F ↔ Ohms) calculator for PT100 and PT1000 RTDs with Class AA, A, and B tolerance bands.
Convert thermocouple millivolt (mV) readings to process temperature and back with live Cold Junction Compensation (CJC).
Estimate cabinet temperature rise, conductive heat transfer, required cooling fan airflow (CFM), and AC capacity (BTU/hr) for enclosures.
Fieldbus, Motion & Control
Compute polynomial 0xA001 CRC-16 checksums in Little-Endian Lo-Byte / Hi-Byte wire order and validate captured RS-485 frames.
Calculate maximum RS-485 trunk length, Modbus RTU 3.5-character silent interval (t3.5), frame duration, and max polling rate.
Compute synchronous speed, motor slip %, output shaft RPM after gearbox reduction, and target VFD command frequency in Hz.
Verify PLC High-Speed Counter (HSC) kHz input limits from encoder PPR, 1x/2x/4x quadrature decoding, shaft RPM, and linear travel.
Convert Independent (Kp, Ki, Kd) vs. ISA Dependent (Kc, Ti, Td) PID gains and compute FOPDT / Ultimate Gain starting parameters.