Appendix B. Example Programs
B-12
EndSelect
EndSub
'Main Program
BeginProg
'Open and configure RS232 port for RS232 communication.
'9600 BAUD is the default:
SerialOpen
(Com1,9600,0,0,200)
n = 1
Scan
(10,Sec,3,0)
Battery
(BattV)
PanelTemp
(PnlTmp_C,_60Hz)
'Make an air temperature measurement.
Therm107
(AirTempC,1,1,Vx1,0,_60Hz,1.0,0)
'Automated snow depth measurement. Must occur two minutes before
'actual storage time to get 11 measurements completed.
If TimeIntoInterval
(58,60,Min)
Then
SR50ACtrl = True
EndIf
'Set this flag to true to get the initial distance from the SR50A
'to the ground.
If
SR50A_MID
Then
SR50ACtrl = True
If
SR50ACtrl
Then
'Transmit serial command "p33<CR>"
SerialOut
(Com1,POLL_A,"",0,0)
'Flush the serial buffer
SerialFlush
(Com1)
'Recieve serial string from SR50A
SerialIn
(SR50AData,Com1,200,CHR(13),50)
'Pars string into separate values.
SplitStr
(ParseVals(),SR50AData,"",5,0)
'Calculate the temperature corrected distance.
SR50A(n,1) = ParseVals(2)*SQR((A273.15)/273.15)
SR50A(n,2) = ParseVals(3)
n += 1
If
n > 11
Then
n = 1
SR50ACtrl = False
SortSpa
(Result_SR50A(1,1),11,SR50A(1,1),2)
TCDT = Result_SR50A(6,1)
Q = Result_SR50A(6,2)
If
SR50A_MID
Then
Inital_Dist = TCDT
SR50A_MID = False
EndIf
Snow_Depth = Inital_Dist - TCDT
EndIf
'Add up any errors across the day.
Call
Diag
EndIf
'Call data tables.
CallTable
Hour
CallTable
Daily
'Clear diagnostic counters after Daily_Status table is stored.
If
Daily.Output(1,1)
Then
ROM_Cntr = 0
SR50A_WtchDg_Cntr = 0
EndIf
NextScan
EndProg
Содержание SR50A
Страница 2: ......
Страница 6: ......
Страница 30: ...SR50A Series Sonic Ranging Sensors 20...
Страница 32: ......
Страница 53: ...Appendix B Example Programs B 21 CallTable Daily CallTable Hour NextScan EndProg...
Страница 54: ...Appendix B Example Programs B 22...
Страница 56: ......
Страница 78: ...Appendix E Tera Term QuickStart E 10...
Страница 83: ......