![Campbell CS120A Скачать руководство пользователя страница 87](http://html1.mh-extra.com/html/campbell/cs120a/cs120a_instruction-manual_488900087.webp)
Appendix C. Example CRBasic programs
C-11
C.6 Example CRBasic MSGSET program
'-------------------------------------------------------------------------------
' CS125 Present Weather and CS120A Visibility sensor
'
' Program to test the MSGSET command part of the command line interface on the CS120A
' Do not run this program for extended periods of time (days!) as it writes
' to flash over and over and will eventually wear the flash out
'-------------------------------------------------------------------------------
Public MSG_Response As String * 200
Public TempString As String * 100
Public CS120CommandString As String * 100
Public CheckValCCITT
'-------------------------------------------------------------------------------
'Main Program
BeginProg
' open port to the visibility sensor
SerialOpen (Com1,38400,3,0,10000)
' Send information once every 30 seconds
Scan (30,Sec,0,0)
' Create a string containing the values going out to the CS125
' Output the dirty window values, the sensor serial number, SYNOP codes and the
' outside temperature.
'Bit- Description- Value- Nibble value
' 16 Reserved -
' 15 Reserved -
' 14 Humidity (%) 0 0x1
' 13 Temperature (Degrees C) 1
' 12 NWS code (3) 0 0x2
' 11 METAR code 0
' 10 SYNOP code (3) 1
' 9 Generic SYNOP (3) 0
' 8 Accumulation (3) 0 0x1
' 7 Intensity (3) 0
' 6 Particle count (3) 0
' 5 Sensor serial number 1
' 4 Dirty windows values 1 0x8
' 3 System alarms
12 0
' 2 User alarms
2 0
' 1
Averaging duration 0
TempString = "MSGSET:0:1218"
' Create a check sum of the values going out
CheckValCCITT = CheckSum (TempString,1,0)
' Create final string including start characters and end characters
CS120CommandString = CHR(2) + Temp ":" + Hex (CheckValCCITT) + ":" + CHR(3) +
CHR(13) + CHR(10)
' Send the string to the sensor
SerialOut (Com1,CS120CommandString,"",0,100) ' Send SET command to the CS120
Delay (1,1,Sec)
Содержание CS120A
Страница 2: ...ii ...
Страница 4: ......
Страница 6: ......
Страница 8: ......
Страница 12: ...vi ...
Страница 73: ...A 1 Appendix A CS120A CS125 block diagram ...
Страница 74: ...CS120A and CS125 Visibility and Present Weather Sensors A 2 ...
Страница 76: ...CS120A and CS125 Visibility and Present Weather Sensors B 2 ...
Страница 90: ......
Страница 93: ...Appendix D Present Weather Codes D 3 ...