How the Modbus register decoder works
Modbus moves data in 16-bit registers, and every register travels with its high byte first. That is all the protocol fixes. A temperature sent as a 32-bit float, or an energy counter sent as a 64-bit integer, is spread over two or four registers, and the order of those registers is chosen by the device maker. Most devices send the high register first, some send the low register first, and a few also swap the two bytes inside each register.
The decoder takes the registers exactly as your master, gateway or test tool shows them and decodes them in all four orders at once. Write the order as the letters of the value’s bytes, A being the most significant: ABCD is big-endian, CDAB is the common word swap, BADC swaps the bytes in each register, DCBA is fully little-endian.
Finding the right byte order
Read a register pair while you know roughly what the device should report, and look for the row that makes sense. The registers 0x4120 0x0000 are 10.0 as ABCD. Read as CDAB they give 2.3 × 10⁻⁴¹, a value no sensor reports, and the decoder greys out such rows. If the device sends the low register first you will see 0x0000 0x4120 instead, and the CDAB row shows the 10.
Once you know the order of one value, it is the same for every value of that device and data type. Write it into the master’s configuration rather than swapping bytes in the PLC program.
Scaling and data types
Many devices send integers with an implied scale: a pressure of 1234 that means 12.34 bar, or a temperature in tenths of a degree. Enter the scale factor and offset from the register map and the decoder shows the engineering value next to the raw one; the value is raw × scale factor + offset. The same factor works backwards when you encode a value to write.
INT16 and UINT16 differ only in how the top bit is read: 0xFFFF is 65535 unsigned and −1 signed. Most register maps state the type for every address; when they do not, a value that should never be negative is usually unsigned.
Register numbers and addresses
Device manuals often list registers as 40001, 30001 or 400001. This is the Modicon convention: the first digit names the table (4 for holding registers, 3 for input registers, 0 for coils, 1 for discrete inputs) and the rest counts from 1. The request on the wire carries the address counted from 0, so 40001 is holding register address 0, read with function code 03. Enter the reference to see the protocol address, the function codes and the registers a multi-register value occupies.
An off-by-one error here is the most common reason for a value that is plausible but wrong: the master reads the second half of one value and the first half of the next.
Frequently asked questions
Why does the decoder show NaN for some rows?
A float whose exponent bits are all ones is not a number, or infinity. A wrong byte order often produces this pattern; so does a device that reports a sensor fault with NaN on purpose. Check the device manual for the second case.
Can I enter the registers as one hex string?
Yes. Eight or sixteen hex digits without spaces are split into registers of four digits, so 41200000 is read as 0x4120 0x0000.
What about Modbus TCP?
The register layout is the same over TCP and RTU; only the framing differs. The byte order of multi-register values belongs to the device, not to the transport.