CS225 Temperature String
16
DataTable (MetaData,1,-1)
DataInterval (0,1,Day,10)
Sample (MetaData_pts,CS225Meta(),FP2)
EndTable
DataTable (TempSample,1,-1)
DataInterval (0,5,Min,10)
Sample (NumTempSensors,CS225TempUserMin(),IEEE4)
Sample (NumTempSensors,CS225TempUserMax(),IEEE4)
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
'Read the current Temperature Min & Max Values Every 5 minutes and Reset the Value
If TimeIntoInterval(0,5,Min) Then
For i=1 To NumTempSensors
'To Read and Reset the User Min Values use SDI-12 R6! or M6! Command. This command is
preferred over the minimum instruction as it constitutes the minimum of all 1 second
measurements taken since the previous aR6! Command.
SDI12Recorder
(CS225TempUserMin(i),CS225_SDI12_Port,ConvertNumToSDI12address(i),"R6!",1.0,0)
'To Read and Reset the User Max Values use SDI-12 R7! or M7! Command. This command is
preferred over the maximum instruction as it constitutes the maximum of all 1 second
measurements taken since the previous aR6! Command.
SDI12Recorder
(CS225TempUserMax(i),CS225_SDI12_Port,ConvertNumToSDI12address(i),"R7!",1.0,0)
Next
EndIf
Содержание CS225
Страница 2: ......