CS225 Temperature String
13
7.2.3.1 CR1000 Program to Read the Meta Data of 15 Sensors Daily
'CR1000 Series Datalogger
'The following Sample program reads a CS225 string that has 15 temperature Sensors
'Declare Public Variables
Public PTemp, batt_volt
'Enter the number of temperature sensors that are in the string (will need to be adjusted
to fit specific applications)
Const NumTempSensors=15
'Calculate the number of Meta Data points based on the number of sensors
Const MetaData_pts=NumTempSensors*3
'Uses the control port C1 on the CR1000 (valid port options are 1,3,5,7)
Const CS225_SDI12_Port=1
Public CS225Meta(NumTempSensors,3) As Float
Dim i As Long
'Define Data Tables
DataTable (MetaData,1,-1)
DataInterval (0,1,Day,10)
Sample (MetaData_pts,CS225Meta(),FP2)
EndTable
'Define Subroutines
'*****************************************************************************
'* --------------------- ConvertNumToSDI12address() ---------------------- *
'* Convert SDI-12 character address (0->9, A->Z, & a->z) to number value *
'* (0->61). *
'*****************************************************************************
Function ConvertNumToSDI12address(address As Long) As String * 1
Select Case address
Case 0 To 9 'ASCII Code 48->57 = 0->9
Return(CHR(a 48))
Case 10 To 35'ASCII Code 65->90 = A->Z = 10->35
Return(CHR(a 55))
Case 36 To 61'ASCII Code 97->122 = a->z = 36->61
Return(CHR(a 61))
EndSelect
Return("")
EndFunction 'ConvertNumToSDI12address()
'EndSub
'Main Program
BeginProg
Scan (60,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
'Read the Meta Data from the sensor daily
'Also read if a non-valid serial number is present (Startup values should be zero).
'A valid serial number will be greater than 1
If (CS225Meta(1,1) < 1) OR (IfTime (0,1440,Min)) Then
For i=1 To NumTempSensors
SDI12Recorder(CS225Meta(i,1),CS225_SDI12_Port,ConvertNumToSDI12address(i),"R1!",1.0,0)
Next
EndIf
CallTable MetaData
NextScan
EndProg
Summary of Contents for CS225
Page 2: ......