beautypg.com

Campbell Scientific 0871LH1 Freezing Rain Sensor User Manual

Page 18

background image

15

'BIT 1 - Ice Output
If (LH1_Byte(1) AND &B00000010) <> 0 Then
LH1_Ice_Output = "Ice"
Else
LH1_Ice_Output = "No Ice"
EndIf

'BIT 2 - Probe Heater State
If (LH1_Byte(1) AND &B00000100) <> 0 Then
LH1_Probe_Heater_State = "On"
Else
LH1_Probe_Heater_State = "Off"
EndIf

'0871LH1 Bytes 2 and 3 are MSO Frequency count
'Calculate Frequency from the count as follows
LH1_MSO_Frequency = 774060000/((LH1_Byte(2) << 8) + LH1_Byte(3))

'Byte 4 is the ERRSTAT1

If (LH1_Byte(4) AND &B1) <> 0 Then
LH1_ERR_PWR_INT_TIMER = "FAIL"
Else
LH1_ERR_PWR_INT_TIMER = "OK"
EndIf

If (LH1_Byte(4) AND &B10) <> 0 Then
LH1_ERR_WATCHDOG = "FAIL"
Else
LH1_ERR_WATCHDOG = "OK"
EndIf

If (LH1_Byte(4) AND &B100) <> 0 Then
LH1_ERR_ROM = "FAIL"
Else
LH1_ERR_ROM = "OK"
EndIf

If (LH1_Byte(4) AND &B1000) <> 0 Then
LH1_ERR_RAM = "FAIL"
Else
LH1_ERR_RAM = "OK"
EndIf

If (LH1_Byte(4) AND &B10000) <> 0 Then
LH1_ERR_EEPROM = "FAIL"
Else
LH1_ERR_EEPROM = "OK"
EndIf

If (LH1_Byte(4) AND &B100000) <> 0 Then
LH1_ERR_MSO_TOO_LOW = "FAIL"
Else
LH1_ERR_MSO_TOO_LOW = "OK"
EndIf

If (LH1_Byte(4) AND &B1000000) <> 0 Then
LH1_ERR_MSO_TOO_HIGH = "FAIL"
Else
LH1_ERR_MSO_TOO_HIGH = "OK"
EndIf

If (LH1_Byte(5) AND &B011000000) = &B00000000 Then
LH1_ERR_PROBE_HEATER = "OK"