Appendix B. Example Programs
B-6
CRBasic Example B-6. CR1000X Program Measuring the CS700H and Monitoring Heater
'Program measures one CS700H and monitors heater via SDI-12
'Wiring Diagram
'==============
'CS700H
'Wire
'Color Function Terminal
'----- -------- --------
'Black Rain signal P1
'White Rain signal ground Ground Symbol
'Clear Shield Ground Symbol
'Green SDI-12 signal C1
'Red SDI-12 power 12V
'Blue SDI-12 ground G
'Declare Variables and Units
Public
BattV
Public
PTemp_C
Public
Rain_in
Public
Info(9)
Alias
Info(1)=CS700H_AirTemp
'CS700H air temperature measurement
Alias
Info(2)=CS700H_BlockTemp
'Heater block temperature
Alias
Info(3)=CS700H_C0_F1
'Temperature units: 0 = deg C, 1 = deg F
Alias
Info(4)=CS700H_NoSnow0_Snow1
'Snow detection
Alias
Info(5)=CS700H_SnwSnsrActv
'Snow sensor on or off
Alias
Info(6)=CS700H_Htr_On_off
'Heater on or off
Alias
Info(7)=CS700H_Control_Auto_Man
'Automatic or Manual heater control
Alias
Info(8)=CS700H_Cycle_Dis_Ena
'Heater cycle disabled or enabled
Alias
Info(9)=CS700H_HTimeLeft
'Heater cycle time left in minutes
Units
BattV = Volts
Units
PTemp_C = Deg C
Units
Rain_in = inch
'Define Data Tables
DataTable
(OneMin,True,-1)
DataInterval
(0,1,Min,10)
Totalize
(1,Rain_in,FP2,False)
Sample
(1,CS700H_AirTemp,FP2)
Sample
(1,CS700H_BlockTemp,FP2)
Sample
(1,CS700H_C0_F1,FP2)
Sample
(1,CS700H_NoSnow0_Snow1,FP2)
Sample
(1,CS700H_SnwSnsrActv,FP2)
Sample
(1,CS700H_Htr_On_off,FP2)
Sample
(1,CS700H_Control_Auto_Man,FP2)
Sample
(1,CS700H_Cycle_Dis_Ena,FP2)
Sample
(1,CS700H_HTimeLeft,FP2)
EndTable
DataTable
(OneDay,True,-1)
DataInterval
(0,1440,Min,10)
Minimum
(1,BattV,FP2,False,False)
Totalize
(1,Rain_in,FP2,False)
EndTable
'Main Program
BeginProg
Scan
(10,Sec,1,0)
'Default Data Logger Battery Voltage measurement BattV
Battery
(BattV)
'Default Data Logger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp
(PTemp_C,_60Hz)
'CS700H Rain Gage measurement Rain_in
PulseCount
(Rain_in,1,P1,1,0,0.01,0)
'SDI-12 Sensor measurements
SDI12Recorder
(Info(),C1,0,"M!",1,0)