Modbus station addresses and locations
In Modbus, a station address acts as a unique identifier for the external sensor device. A station address is assigned when the external sensor device is configured and installed. Multiple stations listen to the bus and can respond only to the commands that match their unique station address.
Connect Tank acts as a client to the server station addresses. All Modbus devices connected to Connect Tank must have the exact same serial configuration.
In the Connect Tank configuration, you can specify a list of variable addresses for each station address. The variable addresses identify the values that should be pulled from each station device.
If Connect Sensor is configured to read a variable that is unsupported by a Modbus station, no data sample is stored.
Finding the Modbus address
A Modbus variable address includes a combination of the reading category, the logical address of the information, and the interpretation method. Together these create a variable address that can be added to a variable list in the Connect Sensor configuration.
Step 1: Determine the reading category
The reading category is the single digit prefix of the variable address. Each variable type has a unique prefix.
Modbus variable type | Number of bits | Prefix value |
---|---|---|
Coil | 1 | 0 |
Discrete input | 1 | 1 |
Input register | 16 | 3 |
Holding register | 16 | 4 |
Step 2: Determine the logical address
Many Modbus device specifications list variables using a 0-based physical address. Since Modbus uses a 1-based logical address, the logical address is calculated by adding one to the physical address. The logical address must have either four or five digits, padded on the left by zeroes if required.
For each configured station address, you can configure a corresponding variable list. The variable list is limited to 63 characters, which limits the number of variables to between 8 and 10.
A variable address can be either 5 or 6 decimal digits in length.
Five decimal digits:
00001 - 09999 | Coils: physical addresses 0 - 9998 |
10001 - 19999 | Discrete inputs: physical addresses 0 - 9998 |
30001 - 39999 | Input registers: physical addresses 0 - 9998 |
40001 - 49999 | Holding registers: physical addresses 0 - 9998 |
Six decimal digits:
00001 - 065536 | Coils: physical addresses 0 - 65535 |
10001 - 165536 | Discrete inputs: physical addresses 0 - 65535 |
30001 - 365536 | Input registers: physical addresses 0 - 65535 |
40001 - 465536 | Holding registers: physical addresses 0 - 65535 |
Step 3: Determine the interpretation method
Generally, a single-bit value is interpreted as either 0 or 1, and a 16-bit value is interpreted as an integer between 0 and 65535. These are the default interpretations for the four categories, and no extra specification is required.
Some Modbus devices, however, specify that a pair of consecutive 16-bit registers should be combined and the 32-bits be interpreted as an IEEE 754 floating point value instead. To indicate this, the Connect Sensor variable address requires a suffix of either ‘f’ or ‘F’:
If the 32-bit value can be represented as DCBA, where D represents the most significant byte of the value, and A represents the least significant byte of the value, two floating point encodings are supported as follows:
f | IEEE 754 floating point value with bytes in the following order: B A D C |
F | IEEE 754 floating point value with bytes in the following order: D C B A |
Examples
- If the device specification defines a simple holding register at physical address 4002, the prefix is 4, the logical address is 4003, and there is no interpretation suffix. The combined logical address is 44003.
- If the device specification defines a coil at physical address 17, the prefix is 0, the logical address is 0018 (zero padded), and there is no interpretation suffix. The combined logical address is 00018.
- If the device specification defines an input register at physical address 7002 that is 32-bit floating point value with bytes presented in D C B A order, the prefix is 3, the logical address is 7003, and the interpretation suffix is ‘F’. The combined logical address is 37003F.