Issue
Modbus slaves are programmed according to device documentation, but either the wrong values are returned or error codes complaining about invalid address.
Product Line
TAC Vista
Environment
- Xenta 913
- Xenta 731
- Xenta 511:B
Cause
The XBuilder Device Editor has two ways to address modbus registers. The improper usage of these methods can cause communication problems because the wrong register is polled.
1. Fixed Address Blocks
This method combines the function code and register address to produce a single number format that serves multiple function codes. This is sometimes referred to as numerical notation.
A poll of a holding register uses function 03 and an address from 00 00 to FF FF. When using Fixed Address Blocks a message of function code 03 and address 00 00 is displayed as 40001. Due to this combination it is limited to 9,999 addresses per function code.
Type | Function Code | Address |
---|---|---|
Coil Status | 01 | 00001-9999 |
Input Status | 02 | 10001-19999 |
Holding Register | 03 | 40001-49999 |
Input Register | 04 | 30001-39999 |
When the device editor is using Fixed Address Blocks then the numerical number is parsed from the Register in the following way.
Register | Function Code | Address |
---|---|---|
1-9999 | 01 | Register - 1 |
10001-19999 | 02 | Register - 10001 |
30001-39999 | 04 | Register - 30001 |
40001-49999 | 03 | Register - 40001 |
2. Function Code Tables
(Discrete Input, Coil, Input Register, Holding Register)
This addressing format is closer to the actual protocol and keeps the function code separate from the register address. It also provides full use of the addresses from 0 to 65535.
Table | Function Code |
---|---|
Discrete Input | 02 |
Coil | 01 |
Input Register | 04 |
Holding Register | 03 |
If the wrong format is used it can result in failure to communicate because the wrong register is used. For example polling register address 40010 on function code 03 when it should have been address 9 on function code 03.
Resolution
The documentation of the product being interfaced with is the best guide on the register addressing and the format they use.
If the documentation does not directly specify the information then use the follow hints to guide your selection:
Hints to use Function Code Tables
- Addresses that fall on zero (0, 10000, 30000, or 40001)
- Non binary data that is less then 30001 or greater then 40001.
- Devices states it is J-Bus.
- Register address is displayed in Hexadecimal format.
Hints to use Fixed Address Blocks
- Any address register above 30000 or 40000, unless it claims to be a JBus device.
If it is still unclear which addressing format to use then experiment with read only data and value pages in the Xenta Servers. Pick a point that you can easily confirm the value, add both address formats to a device template, and then confirm the proper format with a values page. Once you know how to read one point the rest of the product documentation is easier to work with.