C.3 example crbasic set program – Campbell Scientific CS125 Present Weather Sensor User Manual

Page 59

Advertising
background image

Appendix C. Example CRBasic programs

C-5

C.3 Example CRBasic SET program


'-------------------------------------------------------------------------------
' CS125 Visibility
'
' Program to test the SET command part of the command line interface on the CS125
' Do not run this script for extended periods of time (days!) as it writes
' to flash over and over and will eventually wear the flash out
' Logger:CR1000
'-------------------------------------------------------------------------------

Public InString As String * 200
Public TempString As String *100

' Variables for the SET command subroutine
Dim CS125CArray(21) As String * 6 ' CS125 Command Array

'-------------------------------------------------------
' This function creates a SET command string for the
' CS125 visibility sensor. Including all delimiting
' characters and checksums
' then returns the string in "CS125CommandString"
' Array variable order is as follows:
' 1. Sensor ID
' 2. User Alarm 1 Set
' 3. User Alarm 1 Active
' 4. User Alarm 1 Distance
' 5. User Alarm 2
' 6. User Alarm 2 Active
' 7. User Alarm 2 Distance
' 8. Serial BaudRate
' 9. Serial number (Read only so not used)
' 10. Visibility Units
' 11. Continuous mode output interval
' 12. Polling Or Continuous modes
' 13. Message Format (Basic/Partial/Full)
' 14. RS232 or RS485 serial communications enabled
' 15. Averaging Period
' 16. Sample timing
' 17. Dew heater override
' 18. Hood Heater override
' 19. Dirty window compensation
' 20. Use CRC checking
' 21. PSU input voltage shutdown level
Function CS125_SETCommand As String *100
Dim TempStringFunc As String * 100
Dim CS125CommandString As String * 100
Dim i As Long
Dim CheckVal As Long

' Create a string containing the values going out to the CS125
TempStringFunc = "SET:0:"
For i = 1 To 21
TempStringFunc = TempStringFunc + CS125CArray(i) + " "
Next
' Create a check sum of the values going out

Advertising