UM-0085-B09
DT80 Range User Manual
Page 179
RG
If a Modbus client then requests input registers 3:00007-3:00012 it will receive the following raw data:
Register
Value (hex / decimal) Comments
3:00007
47AE
The 32-bit value 41BF47AE is the IEEE754 representation of 23.91
3:00008
41BF
3:00009
BF7E / 49022
490.22 multiplied by scaling factor (100)
3:00010
FFFF / 65535
overflow: 921.0 x 100 = 92100 is too big for an unsigned 16-bit integer
3:00011
0001 / 1
The 32-bit value 00012710 equals 75536 decimal
3:00012
2710 / 10000
To make sense of this, the client software must support the 32-bit data formats used by the
DT80
, and it must be told the
data type of each register (or register pair).
Note1:
Be aware that for 32-bit data types, the word order (i.e. whether the upper or lower 16 bits comes first) is not proscribed by the
Modbus standard, so naturally both orderings are widely used. Most client software can be configured to support either ordering.
Note2:
In this example 7CV and 11CV are spread across two registers apiece (3:00007-8 and 3:00011-12 respectively), which makes
channel variables 8CV and 12CV effectively inaccessible via Modbus. They can still be used in the program (e.g. setting
8CV=42
in
the above program is perfectly OK and won't interfere with 7CV); it's just that they cannot (easily) be accessed by a Modbus client.
Note3:
Some Modbus clients require that all 32-bit register pairs start on an odd-numbered register. That is, you can return a 32-bit
value using registers 30001-30002, but not using registers 30002-30003.
Putting It All Together
In this example, a greenhouse is monitored by a DT80. Three thermocouples on analog inputs
1-3
monitor the
temperature at various points. The DT80 is required to log the temperatures every 15s and switch on an extractor fan (by
setting digital output
1D
low) if any of the temperatures exceed a programmable setpoint. A sensor attached to the fan
produces a voltage proportional to fan speed (1.25mV/rpm) and this is fed into analog input
4
. Digital output
2D
is
connected to a watering system valve.
The DT80 is connected to an Ethernet network. In a central office an operator runs a Modbus-capable SCADA package.
She wants to be able to:
•
check current temperatures
•
set the current extractor fan setpoint
•
check the status of the extractor fan (fan RPM and state of control output)
•
switch the watering system on or off
•
check how many data and alarm records have been logged
The following sections discuss how this might be achieved.
DT80 Configuration
It is assumed that the
DT80
's Ethernet connection has already been set up. This can be verified by entering its IP
address into
DeTransfer
or a web browser and checking that the
DT80
's command or web interface is accessible. If you
cannot connect to these services then you probably won't be able to connect to the Modbus server either. See
for more information. Once TCP/IP connectivity has been established, a suitable
DT80
job can
be entered:
BEGIN"GERANIUM"
SETMODBUS 1..4CV MBI 10
'temperatures & setpoint
SETMODBUS 5..7CV MBL 1
'logged data,alarm recs (32 bit)
SETMODBUS 9CV MBI 1
'fan RPM
4CV(W)=30.0
' default setpoint
'update every 15 sec
RA(DATA:30D,ALARMS:500KB)15S
1TK(NR,=1CV)
2TK(NR,=2CV)
3TK(NR,=3CV)
'set 10CV=1 if at least one temp over limit
'set 11CV=1 if all temps under limit
'allow +/- 1 degC hysteresis
10CV(W)=(1CV>4CV+1)OR(2CV>4CV+1)OR(3CV>4CV+1)
11CV(W)=(1CV<4CV-1)AND(2CV<4CV-1)AND(3CV<4CV-1)
ALARM1(10CV>.5)"Temp>?4 Fan ON^M"{1DSO=0}
ALARM2(11CV>.5)"Fan OFF^M"{1DSO=1}
32SV(W,=5CV)
'num logged data recs for sched A
33SV(W,=7CV)
'num logged alarm recs for sched
A
4V(W,0.8,=9CV)
'fan speed 1.25mV/rpm
LOGONA
END