Appendix B. Example Program
B-2
EndSelect
Return
("")
EndFunction
'ConvertSDI12addr()
'EndSub
'Main Program
BeginProg
Scan
(60,Sec,0,0)
PanelTemp
(PTemp,250)
Battery
(batt_volt)
'Read the current Temperature Value
For
i=1
To
NumTempSensors
SDI12Recorder
(TempC(i),SDI12_Port,ConvertSDI12addr(i),"R0!",1.0,0)
Next
CallTable
Daily
CallTable
TempSample
NextScan
EndProg
B.2 CR1000X Slow Sequence Program
In this example, a CS230/CS231 is polled on control terminal 1 of a CR1000X
in a slow sequence. The CS230 includes 20 temperature sensors with SDI-12
addresses 1 through 9 and A through F. Each sensor is polled with the
aR0!
command every 60 seconds, and stored to a data table on the same interval.
Other common station data is measured every 5 seconds and stored to a daily
and hourly data tables.
CRBasic Example B-2. CR1000X Program Using Slow Sequence to Read CS230/CS231 with 20 Sensors
'CR1000X Series Datalogger
'This program reads a CS230/CS231 probe that has 20 temperature sensors
'Declare Public Variables
Public
PTemp, batt_volt
'Enter the number of temperature sensors that are in the probe (will need to be
'adjusted to fit specific application)
Const
NumTempSensors=20
'Uses the control terminal C1 on the CR1000X
Const
SDI12_Port=C1
Public
TempC(NumTempSensors)
As
Float
Dim
i As Long
'Define Data Tables
DataTable
(Daily,1,-1)
DataInterval
(0,1440,Min,10)
Minimum
(1,batt_volt,FP2,0,False)
Maximum
(1,batt_volt,FP2,0,False)
Average
(1,batt_volt,FP2,0)
EndTable
DataTable
(Hourly,1,-1)
DataInterval
(0,60,Min,10)
Minimum
(1,PTemp,FP2,0,False)
Maximum
(1,PTemp,FP2,0,False)