
Appendix B. Example Program
B-5
B.4 CR1000X Program to Read Metadata and
Measurements of 15 Temperature Sensors
In this example a single CS230/CS231 is on control terminal 1 of a CR1000X.
The CS230/CS231 includes 15 sensors with SDI-12 addresses 1 through 9 and
A through F. Each temperature sensor is polled on power up and daily with the
aR1!
command to determine metadata, which is stored in a daily data table.
The minimum and maximum temperature of each sensor is polled (
aR6!
and
aR7!
respectively) every 5 minutes and stored to a data table on the same
interval. Other common station data is measured every 60 seconds and stored
to a separate daily data table.
CRBasic Example B-4. CR1000X Program Reading Metadata and Measurements of CS230/CS231 with
15 Sensors
'CR1000X Series Datalogger
'This program reads a CS230/CS231 probe that has 15 temperature sensors.
'Individual temperatures, user minimum and maximum are recorded every 5 minutes, and
'Metadata is collected daily.
'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=15
'Calculate the number of metadata points based on the number of sensors
Const
MetaData_pts=NumTempSensors*3
'Uses the control terminal C1 on the CR1000X
Const
SDI12_Port=C1
Public
TempC(NumTempSensors)
As
Float
Public
TempCMax(NumTempSensors)
As
Float
Public
TempCMin(NumTempSensors)
As
Float
Public
Meta(NumTempSensors,3)
As
Float
Dim
i
As
Long
'Define Data Tables
DataTable
(Daily,1,-1)
DataInterval
(0,1,Day,10)
Minimum
(1,batt_volt,FP2,0,False)
Maximum
(1,batt_volt,FP2,0,False)
Average
(1,batt_volt,FP2,0)
Minimum
(1,PTemp,FP2,0,False)
Maximum
(1,PTemp,FP2,0,False)
Average
(1,PTemp,FP2,0)
EndTable
DataTable
(MetaData,1,-1)
DataInterval
(0,1,Day,10)
Sample
(MetaData_pts,Meta(),FP2)
EndTable
DataTable
(TempSample,1,-1)
DataInterval
(0,5,Min,10)
Sample
(NumTempSensors,TempCMin(),IEEE4)
Sample
(NumTempSensors,TempCMax(),IEEE4)
EndTable
'Define Subroutines