Question:
Some vendors describe the addresses of their drivers in particular ways; therefore, the process of interpreting the Modbus addresses prefixes can become rather complicated. So, how can I establish the right interpretation for the prefixes in this device’s address?
Solution:
In order to find the correct process of interpreting the Modbus addresses prefixes correctly, you must realize that they are not always in conformity to what’s expected of them. That is to say, this happens because some vendors will still use an old standard, known as Modbus Convention. By this convention, each address increments one value, which in turn depends on the addressing space accessed by the function. The table below lists the increments used by the old Modbus Convention.
Data type | Modbus function | Increment |
Coils | 01: Read Coils (0x) 05: Write Single Coil (0x) 15: Write Multiple Coils (0x) |
00000 |
Discrete Inputs | 02: Read Discrete Inputs (1x) | 10000 |
Input Registers | 04: Read Input Registers (3x) | 30000 |
Holding Registers | 03: Read Holding Registers (4x) 06: Write Single Register (4x) 16: Write Multiple Registers (4x) |
40000 |
File Register (anteriormente, Extended Memory file) | 20: Read General Reference (6x) 21: Write General Reference (6x) |
60000 |
This increment can also work as a prefix, since these values are all multiple of 10000. Therefore, when setting up the addresses in the driver, you should ignore this increment or prefix. See the examples in the table below:
Address with Increment (Device) |
Address without Increment (Driver) |
Modbus function |
01234 | 1234 | 01: Read Coils 05: Write Single Coil 15: Write Multiple Coils |
11234 | 1234 | 02: Read Discrete Inputs |
31234 | 1234 | 04: Read Input Registers |
41234 | 1234 | 03: Read Holding Registers 06: Write Single Register 16: Write Multiple Registers |
45789 | 5789 | 03: Read Holding Registers 06: Write Single Register 16: Write Multiple Registers |
65789 | 5789 | 20: Read General Reference 21: Write General Reference |
Related articles:
The articles below all refer to common issues faced by the Modbus driver: