Modbus Notes:
1. Go to the properties of the device. Disable non-contiguous reads and device identification. The poll register is likely a holding register (Read Code of 03) and the register number is shown in R2 under the Device Status > Config section of the device properties. This error shows as controllers being offline.
2. You need to determine whether the registers are holding register (read code 03) or input registers (read code 04). Here, they were all set to 03 when they needed to be 04. (The practical application of this is to offset the registers by either 30000 or 40000 in accordance to the Modbus standard). This error shows as all values with a red X in the watch window.
3. Use Modbus Register groups. They allow a group read code (same as above) and a group poll interval (default to 1000ms if you don't have one). Also, make all of the values that were shown in R2 even if they weren't used in R2. It helps with the reading. This error shows as values starting fine in the watch window then getting a red X after a short amount of time; a.k.a. the values go stale.
4. Each of the Modbus registers needs to be offset by 1; i.e. 1 becomes 2. The register status itself is at the value given through R2, so Reg 1 on the group is the register + 1. This is in addition to the offset for the read code. This effects both inputs and outputs. This error shows up as one value with a red X (probably the first value).
5. For the AOs, I used Read Code 03 and Write Code 06. I couldn't find the setting in R2 where this would be different, so I would default to these values. This error shows up as output values with a red X next to the AO value in the watch window.
|
Base Address + Offset |
Actual Register |
Reg# |
AI Name |
|
00115 + 1 |
00116 |
Reg1 |
PF_Total |
|
00115 + 5 |
00120 |
Reg5 |
kW_Total |
|
00115 + 6 |
00121 |
Reg6 |
kVAR |
|
00115 + 7 |
00122 |
Reg7 |
kVA |
|
00115 + 8 |
00123 |
Reg8 |
KW_A |
|
R2 Data Type |
EBO Equivalent |
|
Integer |
16-Bit Unsigned |
|
Long |
32-Bit Unsigned |
|
Float |
32-Bit Real |
|
SignedInteger |
16-Bit Signed |
|
Coil |
Digital coil |
|
Input |
Digital Input |
|
Function Code |
Effect |
Typical* Effective Range |
|
1 |
Read Coil Status |
00001-09999 |
|
2 |
Read Input Status |
10001-19999 |
|
3 |
Read Holding Register |
40001-49999 |
|
4 |
Read Input Register |
30001-39999 |
|
5 |
Write Single Coil Status |
00001-09999 |
|
6 |
Write Single Register |
40001-49999 |
|
15 |
Multiple Write Coil** |
00001-09999 |
|
16 |
Multiple Write Register** |
40001-49999 |
|
Type |
Description |
Data |
Value Range |
Address Range |
Read codes |
Write codes |
|
Coil Status |
Binary Read only |
1 bit |
0-1 |
00001-09999 |
1 |
|
|
Input Status |
Binary Read/Write |
1 bit |
0-1 |
10001-19999 |
2 |
5, 15* |
|
Input Register |
Analog Read Only |
16 bits |
0-65535 |
30001-39999 |
4 |
|
|
Holding Register |
Analog Read/Write |
16 bits |
0-65535 |
40001-49999 |
3 |
6, 16* |
*Many controllers do not support multiple read/write
The read codes are swapped for the analog points (read code 3 corresponds to address range 40001-49999)
Data Types
Modbus registers can only hold 16 bits of information each. to use a 32 or 64 bit number (most analog bacnet points use 32 bit), you will need to specify that this point is taking up two or more registers.
Here is some of the terminology defined while setting up modbus points.
|
Type |
description |
|
Analog / Multistate |
-- |
|
16 bit |
Default. 1 register per value. 2^16 values possible. Also known as a Word ( or 2 bytes) |
|
32 bit |
2 registers per value. 2^32 values possible. Also known as a Double Word. |
|
48 bit |
3 registers per value. 2^48 values possible |
|
64 bit |
4 registers per value. 2^64 values possible. Also known as a Quad word. |
|
unsigned Integer |
This value is only capable of positive numbers. A 16 bit unsigned integer can hold whole numbers between 0-65535 |
|
signed Integer |
This value is capable of negative numbers, at the cost of the first bit of precision. A 16 bit signed integer can hold whole numbers between -32767 -> +32767 |
|
real/integer |
Real (aka floating point) analog values are stored in scientific notation (e.g. 3.24 * 10^4). This allows a greater range of values that can store extremely big numbers, or extremely small numbers, but not both at the same time. The values might not always be represented accurately either, but most software can compensate for these shortcomings. If real or float is not specified, assume that the value is an integer (or int), and that no decimals are represented unless there is a gain less than 1. |
|
mod10k |
'Modulo 10,000' requires multiple registers. Each register holds an integer value from 0-9999 and when used in a program are concatenated for use. For example, reg1:(4022) + reg2:(5333) = value:40225333 |
|
swapped |
Reverses the order of the bits, which is necessary for some controllers. |
|
Gain |
Multiplies the read value by this number before using. This can be used to represent decimal points when multiplying by a decimal number less than 1. A gain of 0.01 (10^-2) will show 2 decimal points. |
|
Offset |
Offsets the value by this number by adding it to the value. For example, this feature could be used to calibrate a sensor if the controller has no way to internally calibrate. This would not effect the value inside the controller. |
|
Digital |
-- |
|
Digital Coil |
0/False or 1/True, for use with writing to input statuses. |
|
16 bit unsigned |
0/False or 1/True, used with the bit masks for writing to holding registers. |
|
Multibit |
-- |
|
(default) |
Commonly with writing or reading from modbus points, they will use a holding register to hold a block of 16 digital points instead of read/writing them individually. This can usually be used even if the controller does not support multiple read/write functions. Multibits can only be found when using the AS as a modbus device (the Modbus Interface) |