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:Stored in Modbus registers
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:- swap bytes inside each register
- keep register order the same
- Example - Real Industrial Data
Modbus registers from a vibration sensor:
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
Legacy Modbus implementations
Many industrial devices were designed decades ago, when memory layout decisions differed between manufacturers. Therefore: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:- Read the two registers
- Try all four byte layouts
- See which one produces a realistic value
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:
11. Practical Tip
Whenever a Modbus float looks incorrect:You can verify the conversion using this free tool: https://g2384.github.io/collection/Hex_Calc_IEEE754_conversion.html

