Networking

Modbus register maps: scaling and byte order

A number read over Modbus is not an engineering value until address base, scale and word order are verified.

In short
  • A device manual address such as 40001 usually means a one-based holding register, while the address on the wire starts at zero.
  • A raw register value such as 253 may mean a decimal scale, so the scale and unit should be taken from the documentation.
  • A 32-bit value spans two consecutive registers, so byte and word order should be tested against a known reference value.

Separate the register types

Modbus defines four data tables: coils, discrete inputs, input registers and holding registers. An address such as “40001” in a device manual usually names the holding-register table with one-based numbering, while the address on the wire starts at zero. That difference produces an off-by-one register and the wrong variable being read.

Take scale and unit from the document

A register carries a 16-bit integer. A temperature arriving as “253” can mean the device defines a decimal scale, for example 25.3. The scale, unit, signed or unsigned interpretation and valid range should be written in the map. The layer that interprets the number should read this from a table, not from code.

Test order on 32-bit and floating-point values

A 32-bit value spans two consecutive registers. Byte order and word order can differ between devices. Test the correct order against a known reference value. A wrong order often gives absurdly large or meaningless numbers, but it can also yield a plausible and wrong number.

Version and verify the map

Store the register map with the device model and firmware version. When commissioning a device, compare three known values: a fixed setting, a simulated value and a hand measurement. This is a suggested verification step; the register layout of a specific device is defined by the manufacturer’s documentation.

Frequently asked

How do I verify scale and units in a Modbus register map?

Take scale, unit, signed or unsigned interpretation and valid range from the device documentation and write them into the map. The layer that interprets the number should read this from a table, not from code. Store the map with the device model and firmware version, and compare three known values when commissioning.

How do I test byte and word order for 32-bit Modbus values?

A 32-bit value spans two consecutive registers, and byte order and word order can differ between devices. Test the order against a known reference value. A wrong order often gives absurdly large or meaningless numbers, but it can also produce a plausible and wrong number.

Sources and further reading

Pilot steps in this guide are proposed engineering workflows. Examples do not constitute measured field performance.

Questions on this topic