Modbus float and IEEE 754 converter
Convert floats to hex and Modbus registers and back, in ABCD, BADC, CDAB and DCBA order
Calculator
Float32 value: 123456
Conversion
Float32 value
123456
Normal
Modbus registers
0x47F1 · 0x2000
Unsigned decimal: 18417 · 8192 · Signed INT16: 18417 · 8192
Hex in selected order
0x47F12000
Transmitted bytes: 47 F1 20 00
IEEE 754 hex
0x47F12000
A B C D: 47 F1 20 00
Details
Sign / exponent / mantissa
0 / 143 / 0x712000
sign: 0 · stored exponent: 143 · mantissa: 7413760
Integer views with 32 bits
1206984704 / 1206984704
UINT32 / INT32
All byte orders
| Order | Hex / Transmitted bytes | Register 1 | Register 2 |
|---|---|---|---|
| ABCD (selected) | 0x47F12000 | 0x47F1 | 0x2000 |
| BADC | 0xF1470020 | 0xF147 | 0x0020 |
| CDAB | 0x200047F1 | 0x2000 | 0x47F1 |
| DCBA | 0x0020F147 | 0x0020 | 0xF147 |
Formulas
An IEEE 754 float32 occupies two consecutive Modbus registers with 16 bits each. Byte and word order depend on the device
A B C D = IEEE 754 bytes from most to least significant
ABCD: registers AB / CD · BADC: BA / DC
CDAB: registers CD / AB · DCBA: DC / BA
Assumptions and limitations
- A to D name the IEEE 754 bytes from most to least significant, regardless of the browser's memory order
- Enter decimals from 0 to 65535, signed INT16 values from −32768 to −1, or hex with 0x
- NaN, ±Infinity, −0 and subnormal values are valid IEEE 754 states and are identified in the result
- Modbus sends each register's high byte first. Follow the device manual for float32 order and check it with a known value
Sources
The formulas and conventions were checked against the following sources: