Appendix C. Example CRBasic programs
C-9
C.5 Example CRBasic GET program
'-------------------------------------------------------------------------------
' CS120A Visibility
'
' Program to test the GET command part of the command line interface on the CS120A
' Connecting to serial port one on a CR1000 logger
' Logger:CR1000
'
' Example outputs including checksums (varies with sensor ID)
' GET:0:0:2C67:
' GET:1:0:1B57:
' GET:2:0:4207:
' GET:3:0:7537:
' GET:4:0:F0A7:
' GET:5:0:C797:
' GET:6:0:9EC7:
' GET:7:0:A9F7:
' GET:8:0:85C6:
' GET:9:0:B2F6:
'-------------------------------------------------------------------------------
Public OutString As String * 40 ' Outgoing string
Dim CheckVal As Long ' Checksum value
Public InString As String * 200 ' Incomming string
Dim TempString As String * 16
'Main Program
BeginProg
SerialOpen (Com1,38400,3,0,10000) ' open port to the visibility sensor
' Send a request for information once every 10 seconds
Scan (10,Sec,0,0)
' Create the basic GET string for the CS120A
TempString = "GET:0:0"
CheckVal = CheckSum (TempString,1,0) ' Use the CCITT CRC16 checksum
OutString = CHR(2) + Temp ":" + FormatLong (CheckVal,"%04X") + ":" + CHR(3)
+ CHR(13) + CHR(10)
SerialOut (Com1,OutString,"",0,100) ' Send GET command to the CS120A
Delay (1,1,Sec)
SerialIn (InString,Com1,100,0,200) ' Save the data returned from the GET command
NextScan
EndProg
Содержание CS120A
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 8: ......
Страница 23: ...User Guide 13...
Страница 24: ...CS120A Visibility Sensor 14...
Страница 25: ...User Guide 15...
Страница 50: ...CS120A Visibility Sensor A 2...
Страница 52: ...CS120A Visibility Sensor B 2...