beautypg.com

Appendix b. example programs, B.1 crbasic programs, B.1.1 example cr1000 program using sequential mode – Campbell Scientific CS106 Barometer User Manual

Page 25: B.1.1, Appendix b, Ee appendix b

background image

Appendix B. Example Programs

B.1 CRBasic Programs

B.1.1 Example CR1000 Program Using Sequential Mode

This CR1000 program uses the sequential mode, which is the simplest mode

and can be used for most meteorological applications. Although the 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. To do this, the

CR1000 uses a control port to turn on the CS106 one minute before the top of

the hour. On the hour, the datalogger measures the CS106, and then turns the

CS106 off. This example assumes that the jumper is in the default position

(open).

'CR1000

'Declare Variables and Units
Public BattV
Public PTemp_C
Public BP
Public BP_mmHg

Units BattV=Volts
Units PTemp_C=Deg C
Units BP = hPa
Units BP_mmHg=mmHg

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,60,Min,10)
Sample(1,BP_mmHg,FP2)
EndTable

DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
'Main Scan
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_60Hz)
'CS106 Barometric Pressure Sensor measurement 'BP_mmHg'
If TimeIntoInterval(59,60,Min) Then PortSet(1,1)
If TimeIntoInterval(0,60,Min) Then
VoltSe(BP,1,mV2500,1,1,0,_60Hz,0.240,500)
BP_mmHg=BP*0.75006
PortSet(1,0)
EndIf
'Call Data Tables and Store Data
CallTable(Table1)
CallTable(Table2)
NextScan
EndProg

B-1