04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 8. Operation<br />

Syntax<br />

DNPUpdate (DNPSlaveAddr,DNPMasterAddr)<br />

8.6.1.2.3 Programming for Data-Acquisition<br />

As shown in CRBasic example Implementation of DNP3 (p. 366), program the<br />

<strong>CR1000</strong> to return data when polled by the DNP3 master using the following three<br />

actions:<br />

1. Place DNP() at the beginning of the program between BeginProg and Scan().<br />

Set COM port, baud rate, and DNP3 address.<br />

2. Setup the variables to be sent to the master using DNPVariable(). Dual<br />

instructions cover static (current values) and event (previous ten records) data.<br />

o For analog measurements:<br />

o<br />

DNPVariable(Variable_Name,Swath,30,2,0,&B00000000,0,0)<br />

DNPVariable(Variable_Name,Swath,32,2,3,&B00000000,0,10)<br />

For digital measurements (control ports):<br />

DNPVariable(Variable_Name,Swath,1,2,0,&B00000000,0,0)<br />

DNPVariable(Variable_Name,Swath,32,2,3,&B00000000,0,10)<br />

3. Place DNPUpdate() after Scan(), inside the main scan. The DNP3 master is<br />

notified of any change in data each time DNPUpdate() runs; e.g., for a 10<br />

second scan, the master is notified every 10 seconds.<br />

CRBasic Example 66.<br />

Public IArray(4) As Long<br />

Public BArray(2) As Boolean<br />

Public WindSpd<br />

Public WindDir<br />

Public Batt_Volt<br />

Public PTemp_C<br />

Units WindSpd=meter/Sec<br />

Units WindDir=Degrees<br />

Units Batt_Volt=Volts<br />

Units PTemp_C=Deg C<br />

'Main Program<br />

BeginProg<br />

Implementation of DNP3<br />

'DNP communication over the RS-232 port at 115.2kbps. Datalogger<br />

'DNP address is 1<br />

DNP(COMRS-232,115200,1)<br />

'DNPVariable(Source, Swath, DNPObject, DNPVariation, DNPClass, DNPFlag,<br />

'DNPEvent, DNPNumEvents)<br />

DNPVariable(IArray,4,30,2,0,&B00000000,0,0)<br />

366

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!