B-1
Appendix B. Example Programs
B.1 TB4 or CS700 Example Programs
B.1.1 CR6 Program for the TB4 or CS700
In the following CR6 program, the TB4 or CS700 is connected to
U1
, and the
rain measurements are reported in inches. Battery voltage and panel
temperature are also measured.
CRBasic Example B-1. CR6 Program Measuring the TB4 or CS700
'Program measures one TB4 or CS700
'Wiring Diagram
'==============
'Wire
'Color Function Terminal
'----- -------- --------
'Black Rain signal U1
'White Rain signal ground Ground Symbol
'Clear Shield Ground Symbol
'Declare Variables and Units
Public
BattV
Public
PTemp_C
Public
Rain_in
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)
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
(5,Sec,1,0)
'Default Data Logger Battery Voltage measurement BattV
Battery
(BattV)
'Default Data Logger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp
(PTemp_C,60)
'Rain Gage measurement Rain_in
PulseCount
(Rain_in,1,U1,1,0,0.01,0)
'Call Data Tables and Store Data
CallTable
OneMin
CallTable
OneDay
NextScan
EndProg