3 programming for data-acquisition, Crbasic example 66. implementation of dnp3 – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 366

Section 8. Operation
366
Syntax
DNPUpdate (DNPSlaveAddr,DNPMasterAddr)
8.6.1.2.3 Programming for Data-Acquisition
As shown in CRBasic example Implementation of DNP3
(p. 366),
program the
CR1000 to return data when polled by the DNP3 master using the following three
actions:
1. Place DNP() at the beginning of the program between BeginProg and Scan().
Set COM port, baud rate, and DNP3 address.
2. Setup the variables to be sent to the master using DNPVariable(). Dual
instructions cover static (current values) and event (previous ten records) data.
o For analog measurements:
DNPVariable
(Variable_Name,Swath,30,2,0,&B00000000,0,0)
DNPVariable
(Variable_Name,Swath,32,2,3,&B00000000,0,10)
o For digital measurements (control ports):
DNPVariable
(Variable_Name,Swath,1,2,0,&B00000000,0,0)
DNPVariable
(Variable_Name,Swath,32,2,3,&B00000000,0,10)
3. Place DNPUpdate() after Scan(), inside the main scan. The DNP3 master is
notified of any change in data each time DNPUpdate() runs; e.g., for a 10
second scan, the master is notified every 10 seconds.
CRBasic Example 66. Implementation of DNP3
Public
IArray(4)
As Long
Public
BArray(2)
As Boolean
Public
WindSpd
Public
WindDir
Public
Batt_Volt
Public
PTemp_C
Units
WindSpd=meter/Sec
Units
WindDir=Degrees
Units
Batt_Volt=Volts
Units
PTemp_C=Deg C
'Main Program
BeginProg
'DNP communication over the RS-232 port at 115.2kbps. Datalogger
'DNP address is 1
DNP
(COMRS-232,115200,1)
'DNPVariable(Source, Swath, DNPObject, DNPVariation, DNPClass, DNPFlag,
'DNPEvent, DNPNumEvents)
DNPVariable
(IArray,4,30,2,0,&B00000000,0,0)