Campbell Scientific 0871LH1 Freezing Rain Sensor User Manual
Page 16

13
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,Ice,IEEE4)
Sample (1,Ice_mm,IEEE4)
EndTable
'This Subroutine Sets all values to a Defaut Error State if Serial Communications do not work
Sub LH1_Error_State
LH1_Probe_Heater_State = "NAN"
LH1_Ice_Output = "NAN"
LH1_Status_Output = "NAN"
LH1_ERR_MSO_TOO_HIGH = "NAN"
LH1_ERR_MSO_TOO_LOW = "NAN"
LH1_ERR_EEPROM = "NAN"
LH1_ERR_RAM = "NAN"
LH1_ERR_ROM = "NAN"
LH1_ERR_WATCHDOG = "NAN"
LH1_ERR_PWR_INT_TIMER = "NAN"
LH1_ERR_DE_ICING = "NAN"
LH1_ERR_PROBE_HEATER = "NAN"
LH1_MSO_Frequency = NAN
LH1_ON_Time_Days = NAN
LH1_Cold_Start_Count = NAN
LH1_ICE_Count = NAN
LH1_FAIL_Count = NAN
LH1_MSO_FAIL_Count = NAN
LH1_Heater_FAIL_Count = NAN
LH1_Software_Version = NAN
LH1_ICE_Count_From_PWR_ON = NAN
LH1_CHECKSUM = NAN
EndSub
'******************************************************************************************
'0871LH1_GetData Subroutine (Typically Takes 3 Seconds to execute)
'******************************************************************************************
'Use an MD485 configured to RS-485, RS-232 Transparent Mode. 9600 BAUD for RS-232 and RS-485
Sub LH1_GetData
Dim Stay_In_Loop As Boolean
Dim CheckForBlankTime As Boolean
Dim LoopCounter
Dim Old_Byte_Count As Float
Dim TimeSinceLastByte As Float
Dim LH1_Raw_In_Buff As String * 50
SerialFlush (LH1_comport)
'Obtain the current byte count
Old_Byte_Count = SerialInChk (LH1_comport)
'Initializations reset and start the timer
Timer (1,mSec,2)
CheckForBlankTime = False
LH1_Serial_Error = False
Stay_In_Loop = True
While Stay_In_Loop = True
'Get the existing byte count
LH1_Byte_Count = SerialInChk (LH1_comport)
'reset the timer if the byte cound is not the same
If LH1_Byte_Count <> Old_Byte_Count Then