Campbell Scientific CS725 Snow Water Equivalency Sensor User Manual

Page 43

Advertising
background image

CS725 Snow Water Equivalency Sensor

'Main Program
BeginProg


'Prepare COM1 for the CS725
SerialOpen (Com1,9600,3,0,1000)


'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 will
'calculate SWE on the Hour every 6 Hours.
'The CS725 is read every 6 hour in this program.

'The reading will take place 10 minutes After the period to ensure the CS725 is not
'processing calculations at the top of the hour when the measurement is requested

'flag is set 10 minutes into every 6 hour period
If TimeIntoInterval (10,360,Min) Then Read_CS725_SWE_Flag = TRUE
'If the flag is high obtain a measurement

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


'Flush the serial buffer
SerialFlush (Com1)


'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
'08/11/2010 11:59: 1234 23 637733 485431 24425 80 76 79 22 23 21 0 6 12 24 -1 1.3 12.05


'Split out the string into smaller strings - use a space as the filter
SplitStr (CS725SplitStr(1),CS725SerialIn," ",20,5)


'first string contains 08/11/2010
SplitStr (CS725_Date_Time(1),CS725SplitStr(1),"",3,0)


'Next string contains HH:MM
SplitStr (CS725_Date_Time(4),CS725SplitStr(2),"",2,0)


'Next string contains the station identifier and is left as a string
CS725_StationID = CS725SplitStr(3)


'The next 17 strings are all numerical values
For loopcount = 1 To 17 Step 1


'Convert all strings to numbers
'Values produced are as follows"

'CS725_SerialNum *Suggest to Output to Final Storage*
'CS725_K_Uncorrected
'CS725_K_Counts

*Suggest to Output to Final Storage*

'CS725_TL_Counts

*Suggest to Output to Final Storage*

'CS725_SWE_K

*Suggest to Output to Final Storage*

'CS725_K_TL_Ratio

*Suggest to Output to Final Storage*

'CS725_SWE_TL

*Suggest to Output to Final Storage*

'CS725_SM_K
'CS725_SM_TL

'CS725_SM_K_TL
'CS725_Precip_Index
'CS725_Crystal_TEMP_MIN *Suggest to Output to Final Storage*

35

Advertising