PLC Data Converter (Hex, Binary, BCD, Float Registers)
Convert a number between decimal, hex, binary and BCD as a 16-bit word, and turn a floating-point value into the two registers a Modbus device sends.
16-bit word
Floating-point value to registers
Two registers to a floating-point value
Uses the register order selected above.
How it works
A PLC register holds 16 bits. The same 16 bits can be read as an unsigned number (0 to 65535), a signed integer (−32768 to 32767), four hex digits or 16 binary digits. BCD (binary-coded decimal) stores each decimal digit in its own four bits, so 1234 becomes 0001 0010 0011 0100, which some thumbwheel switches and displays use.
A 32-bit floating-point number (IEEE 754 single precision) takes two registers. Devices disagree on which register comes first, so a value that reads as nonsense is often just the registers in the wrong order. Try the other order.
Worked example
- Decimal 1234 is 0x04D2 and binary 0000 0100 1101 0010.
- Decimal −2 stored as a 16-bit word is 0xFFFE (65534 unsigned).
- The value 123.456 is 0x42F6E979: register 1 = 0x42F6 (17142), register 2 = 0xE979 (59769).
Common questions
My Modbus float reads as a huge or tiny number. What is wrong?
Usually the word order. Swap the two registers. If that does not help, check that you are reading the right starting address, and whether your driver applies an offset of 1.
Is the byte order inside a register ever swapped?
Modbus sends the high byte of each register first. Some devices and gateways differ, and a few swap the bytes within each register as well. This tool only swaps whole registers.
This tool is provided for convenience. Verify results against the device documentation.