Skip to main content
When transferring floating-point values via Modbus TCP/IP, devices often split a 32-bit floating-point number into two 16-bit Modbus registers. However, many industrial devices send the bytes in a different order than the receiving PLC expects.
This is why we often need to apply a Big-Endian Byte Swap before converting the registers to a floating-point value.
This guide explains:
  • Why byte swapping is needed
  • What Big-Endian Byte Swap (BADC) means
  • How to convert registers into a REAL / float
  • Multiple real industrial examples

1. Why Byte Swapping is Needed in Modbus

The Modbus protocol was originally designed to transfer 16-bit register values. A register contains:
But a floating-point number requires:
So a device must split the float across two registers. Example float:
IEEE-754 representation:
Split into bytes:

Stored in Modbus registers

This layout is called:

2. The Industry Problem

The Modbus specification does not define how 32-bit values should be arranged across registers. Different vendors, therefore, implemented different byte orders. Common layouts used in industry: Because of this, PLCs often must rearrange the bytes before converting to a float.

3. What Big-Endian Byte Swap Means

Big-Endian Byte Swap rearranges the bytes from:
to:
This means:
  • swap bytes inside each register
  • keep register order the same
Visual representation:

  1. Example - Real Industrial Data

Modbus registers from a vibration sensor:
Convert to HEX:
Bytes:
Apply Byte Swap (BADC):
Combine into 32-bit value:
Convert to float:

5. How PLCs Perform This Conversion

Typical steps used in PLC or C/C++ code:

Step 1 - Extract bytes

Step 2 - Rearrange bytes

Step 3 - Combine into a 32-bit value

Step 4 - Interpret as float

6. Why Industry Uses Byte Swapping

Byte swapping is common in industrial automation because devices may have:

Different CPU architectures

Examples:
  • ARM processors
  • Intel processors
  • DSP controllers
  • Embedded microcontrollers
Each architecture may represent multi-byte values differently.

Legacy Modbus implementations

Many industrial devices were designed decades ago, when memory layout decisions differed between manufacturers. Therefore:
PLCs must adapt to the device format.

Sensor manufacturers

Common devices requiring byte swapping:
  • Vibration sensors
  • Power meters
  • Drives
  • Temperature transmitters
  • PLC-to-PLC communication
  • SCADA systems

9. How Engineers Detect the Correct Byte Order

A common debugging trick:
  1. Read the two registers
  2. Try all four byte layouts
  3. See which one produces a realistic value
Example: Expected vibration value:
Possible interpretations:
Correct format is clearly:

Try it: Modbus float converter

Enter your two registers to see all four byte orders at once, or enter a float to see which registers a device would send. The example values are the vibration sensor registers from section 4. Bookmark the standalone version: Modbus float converter.

10. Summary

Key points:
  • Modbus registers are 16-bit
  • Floats require 32-bit
  • Devices split floats across two registers
  • Modbus does not define 32-bit ordering
  • Different vendors use different layouts
  • Big-Endian Byte Swap (BADC) rearranges bytes from:
This ensures the PLC reconstructs the correct IEEE-754 floating-point value.

11. Practical Tip

Whenever a Modbus float looks incorrect:
In many industrial sensors, the correct format is:
You can verify the conversion using this free tool: https://g2384.github.io/collection/Hex_Calc_IEEE754_conversion.html