beautypg.com

B.1.2 example cr1000 program using pipeline mode, B.1.2 – Campbell Scientific CS106 Barometer User Manual

Page 26

background image

Appendix B. Example Programs

B.1.2 Example 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 CS106 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 "CS106_temp". Once the CS106 is turned on one

minute before the hour, the CS106 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.

The program’s integration parameter for the

VoltSE() instruction is _60Hz.

However, for Eddy Covariance programs or other datalogger programs that are

executed at a higher frequency, the integration parameter should be 250 µs

instead of _60Hz or _50Hz. This prevents skipped scans.

'CR1000 Datalogger

Public CS106_temp, pressure
Units pressure = mbar

DataTable (met_data,True,-1)
DataInterval (0,60,min,10)
Sample (1,pressure,IEEE4)
EndTable

BeginProg
PipeLineMode
Scan (1,sec,3,0)

'Measurement is made every scan outside the "If" statement
VoltSE (CS106_temp,1,mV2500,1,False,0,_60Hz,0.240,500)

'Turn on CS106 one minute before the hour
If (TimeIntoInterval (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 CS106 after the measurement
If (TimeIntoInterval (0,60,min)) Then
pressure = CS106_temp
WriteIO (&b1000,&b0)
EndIf

CallTable met_data

NextScan
EndProg

B-2