2 modbus, 1 overview – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 367

Section 8. Operation
367
'Object group 30, variation 2 is used to return analog data when the CR1000
'is polled. Flag is set to an empty 8 bit number(all zeros), DNPEvent is a
'reserved parameter and is currently always set to zero. Number of events is
'only used for event data.
DNPVariable
(IArray,4,32,2,3,&B00000000,0,10)
DNPVariable
(BArray,2,1,1,0,&B00000000,0,0)
DNPVariable
(BArray,2,2,1,1,&B00000000,0,1)
Scan
(1,Sec,1,0)
'Wind Speed & Direction Sensor measurements WS_ms and WindDir:
PulseCount
(WindSpd,1,1,1,3000,2,0)
IArray(1) = WindSpd * 100
BrHalf
(WindDir,1,mV2500,3,1,1,2500,True,0,_60Hz,355,0)
If WindDir>=360 Then WindDir=0
IArray(2) = WindDir * 100
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery
(Batt_Volt)
IArray(3) = Batt_Volt * 100
'Wiring Panel Temperature measurement PTemp_C:
PanelTemp
(PTemp_C,_60Hz)
IArray(1) =PTemp_C
PortGet
(Barray(1),5)
'Update DNP arrays and send unsolicited requests to DNP Master address 3
DNPUpdate
(2,3)
NextScan
EndProg
8.6.2 Modbus
8.6.2.1 Overview
Modbus is a widely used SCADA communication protocol that facilitates
exchange of information and data between computers / HMI software, instruments
(RTUs) and Modbus-compatible sensors. The CR1000 communicates via Modbus
over RS-232, RS-485, and TCP.
Modbus systems consist of a master (PC), RTU / PLC slaves, field instruments
(sensors), and the communications-network hardware. The communications port,
baud rate, data bits, stop bits, and parity are set in the Modbus driver of the master
and / or the slaves. The Modbus standard has two communications modes, RTU
and ASCII. However, CR1000s communicate in RTU mode exclusively.
Field instruments can be queried by the CR1000. Because Modbus has a set
command structure, programming the CR1000 to get data from field instruments
is much simpler than from serial sensors. Because Modbus uses a common bus
and addresses each node, field instruments are effectively multiplexed to a
CR1000 without additional hardware.
A CR1000 goes into sleep mode after 40 seconds of communications inactivity.
Once asleep, two packets are required before the CR1000 will respond. The first
packet awakens the CR1000; the second packet is received as data. CR1000s,
through DevConfig or the Status table (see the appendix Status Table and Settings
(p. 527)
) can be set to keep communications ports open and awake, but at higher
power usage.