beautypg.com

Crbasic example 2: cr1000 program using, Pipeline mode – Campbell Scientific CS100 Barometric Pressure Sensor User Manual

Page 19

background image

CS100 Barometric Pressure Sensor

EndIf
'Call Data Tables and Store Data

CallTable(Table1)
CallTable(Table2)
NextScan
EndProg

7.3.3.2 CRBasic Example 2: CR1000 Program Using Pipeline Mode

Although this example is for the CR1000, other CRBasic dataloggers, such as
the CR200(X), CR800, CR850, CR3000, and CR9000(X) are programmed
similarly. In the example, the CR1000 measures the CS100 once an hour in a
program that runs at 1 Hz. In order to keep the CR1000 running in a pipeline
mode, the measurement instruction is placed outside the “If” statement. The
measurement is made every scan, and the measured value is first written into a
temporary variable called "CS100_temp". Once the CS100 is turned on one
minute before the hour, the CS100 starts to make the correct pressure
measurements. At the top of the hour, the correct value is copied into the
current variable called "pressure", and the sensor is turned off immediately.

'CR1000 Datalogger

Public CS100_temp
Public pressure
Units pressure = mbar


DataTable (met_data,True,-1)
DataInterval (0,60,min,10)

Sample (1,pressure,IEEE4)
EndTable

BeginProg
Scan (1,sec,3,0)


'Measurement is made every scan outside the “If” statement
VoltSE (CS100_temp,1,mV2500,15,False,200,250,0.2,600)


'Turn on CS100 one minute before the hour
If (IfTime (59,60,min)) Then WriteIO (&b1000,&b1000)


'Copy the correct value to a current variable called “pressure” at the top of the
hour

'Turn off CS100 after measurement
If (IfTime (0,60,min)) Then
pressure = CS100_temp

WriteIO (&b1000,&b0)
EndIf


CallTable met_data

NextScan
EndProg

13