Campbell Scientific CS725 Snow Water Equivalency Sensor User Manual

Page 45

Advertising
background image

CS725 Snow Water Equivalency Sensor

'Define Data Tables
DataTable (Diagnostics,1,-1)

DataInterval (0,1440,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Maximum (1,batt_volt,FP2,0,False)

Minimum (1,PTemp,FP2,0,False)
Maximum (1,PTemp,FP2,0,False)
EndTable


'Define Data Tables
DataTable (CS725Hourly,1,-1)

DataInterval (0,60,Min,10)
Sample (8,CS725_RET_Values(1),IEEE4)

EndTable

'Main Program

BeginProg

'Prepare COM1 for the CS725

SerialOpen (Com1,9600,3,0,10000)

'Scan rate is dependent on application

Scan (30,Sec,7,0)
PanelTemp (PTemp,250)
Battery (batt_volt)


'Based on the Factory default settings of the CS725 the CS725 will

'calculate SWE on the Hour every 6 Hours.
'We will simply read the CS725 every hour in this program.
'The reading will take place 10 minutes After the hour to ensure the CS725

'is not burdened with extra processing when the measurement is requested

If TimeIntoInterval (10,60,Min) Then Read_CS725_SWE_Flag = TRUE

EndIf

If Read_CS725_SWE_Flag = TRUE Then

'Reset the Flag
Read_CS725_SWE_Flag = False

'Load the command into the string
CS725_COMMAND_String = CS725_Command_get_output


'Send the command string out
SerialOut (Com1,CS725_COMMAND_String,"",0,0)


'Wait up to 2 seconds, a <CR> or 100 chars for the values to be returned.
SerialIn (CS725SerialIn, Com1, 200,13, 100)


'The string is in the following format
'23/09/2009 18:59:50 123 456

'Split out the time stamp and values 8 numbers are returned
SplitStr (CS725_RET_Values(),CS725SerialIn,"",8,0)

'The contents of the array are as follows:
'Day,Month,Year,Hour,Min,Second,SWE-from K, SWE-from TL
EndIf


'Call Output Tables.
CallTable Diagnostics

CallTable CS725Hourly

NextScan


EndProg

37

Advertising