Register Functions
All 32 bit data point values are encoded in 2 Modbus registers (16bits each). Modbus master systems should always query
the A8332-8F2D using a single query to read an entire block of registers. Never use two queries to read one register and
then combine the two results into a single 32 bit value. Doing so will allow the input value to increment in the middle of the
two Modbus queries, and will cause intermittent data readings that are incorrect.
For example, an input has a decimal value of 65534. This is represented as a 32 bit hex number 0x0000FFFE. The first 4
digits are the MSW register, the second 4 digits are the LSW register. The Modbus Master reads the first (MSW) register
and gets 0x0000. In the moment between the two readings, the input raises 2 more digits (in decimal), making the total
65536 or 0x00010000 in hex. Next the Master reads the second (LSW) register and gets 0x0000. When the two registers
are combined, the result is 0x00000000. The proper way to handle this situation is to simply read both registers in a single
Modbus query.
Data Conversion
Knowing the register values and types, and expected ranges of resultant values, calculate to derive the sensor readings from
the Modbus register values listed above.
Example
Registers 40001 and 40002 typically describe an Air Temperature reading from a 4-20mA sensor on Input 1. The expected
minimum sensor value (in degrees F) is -40º F and the maximum is 122º F.
The minimum value is two unsigned 32-bit integers, MSW=0, LSW=0, and the maximum is MSW=65535, LSW=65535.
To calculate a single value
x
from those by combining each register
R
[
address
]
, shift the higher word register value in order to
add it the lower register value, as follows.
x
= (
R
40001
) * 10000 ) + (
R
40002
)
Calculate the slope
m
for
y
as follows.
m
= (
x
2
-
x
1
) / (
y
2
-
y
1
) = ( 6553565535-0 ) / ( 122--40 ) ≈ 39960765.457
So the approximate temperature
T
value is as follows.
T
= ( ( ( ( register 40001 ) * 10000 ) + ( register 40002 ) ) / 39960765 ) - 40
If register 40001 was 32767, and register 40002 was 32767, then the resulting value would be interpreted as approximately
41.9º F, which is about half of the Air Temperature range listed above.
Use similar formulae to derive the values for the other sensors based on the register values for those types. Resistive
measurements may require curve scales.
Page 30
Draft Copy
A89WS Weather Station (gen 3)