beautypg.com

C.4 example crbasic setnc command – Campbell Scientific CS125 Present Weather Sensor User Manual

Page 61

background image

Appendix C. Example CRBasic programs

C-7

C.4 Example CRBasic SETNC Command

'-------------------------------------------------------------------------------
' CS125 Visibility
'
' Program to test the SETNC command part of the command line interface on the CS125
' This command does not commit the settings to flash so settings will be lost if
' the sensor is power cycled
' This example uses a CS215 temperature and humidity probe to determine dew point.
' The CS125s hood heaters are then turned on only when needed, this is to save
power.
' Logger:CR1000
'-------------------------------------------------------------------------------

'Declare Public Variables
Public InStringSETNC As String * 200
Public InStringGET As String * 200
Public TRHData(2)
Public OutString As String * 40, CheckVal

Dim CS125CArray(21) As String * 6 ' CS125 Command Array
Dim TempDewPoint
Dim StatusDewHeater
Dim TempString As String * 100

Alias TRHData(1)=AirTC
Alias TRHData(2)=RH

'-------------------------------------------------------
' This function creates a SETNC 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_SETNCCommand As String *100
Dim TempStringFunc As String * 100