B-1
Appendix B. Example Programs
B.1 CR6 SDI-12 Program
CRBasic Example B-1. CR6 SDI-12 Program
'CR6 Series
'Declare Variables and Units
Public
BattV
Public
PTemp_C
Public
OBS501(4)
Alias
OBS501(1)=Turb_BS
Alias
OBS501(2)=Turb_SS
Alias
OBS501(3)=Temp_C
Alias
OBS501(4)=WD_OBS
Units
BattV=Volts
Units
PTemp_C=Deg C
Units
Turb_BS=FBU
Units
Turb_SS=FNU
Units
Temp_C=Deg C
Units
WD_OBS=unitless
'Define Data Tables
DataTable
(Table1,True,-1)
DataInterval
(0,60,Min,10)
Sample
(1,Turb_BS,FP2)
Sample
(1,Turb_SS,FP2)
Sample
(1,Temp_C,FP2)
Sample
(1,WD_OBS,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,60)
'OBS501 Smart Turbidity Meter (SDI-12) measurements 'Turb_BS', 'Turb_SS', 'Temp_C', and 'WD_OBS'
SDI12Recorder
(OBS501(),C1,"0","M!",1,0)
'Call Data Tables and Store Data
CallTable Table1
CallTable
Table2
NextScan
EndProg