Specifications

SR50A Sonic Ranging Sensor
Public ParseVals(6) as FLOAT
Alias ParseVals(1)=SerialAddress
Alias ParseVals(2)=Dist_To_Snow
Alias ParseVals(3)=SignalQuality
Alias ParseVals(4)=SR50AT_Temp
Alias ParseVals(5)=Diagnostics
Alias ParseVals(6)=Chcksum
Public Snow_Depth
'Declare the initial distance of the SR50AT from the ground in meters:
Const Initial_Distance=2.5
'Define Data Tables
DataTable (Table1,True,-1)
DataInterval (0,60,Min,10)
Sample (1,Snow_Depth,FP2)
EndTable
'Main Program
BeginProg
'Open RS232 port for communications 9600 BAUD is the default:
SerialOpen (Com1,9600,0,0,2000)
Scan (10,Sec,0,0)
'Measure the SR50A:
'Transmit serial command "p33<CR>"
SerialOut (Com1,"p33"+chr(13),"",0,0)
'Flush the serial buffer
SerialFlush (Com1)
'Recieve serial string from SR50A
SerialIn (SR50AData,Com1,200,13,50)
SplitStr (ParseVals,SR50AData,"",6,0)
'Subtract the corrected distance from the initial distance of the SR50A to the ground:
Snow_Depth=Initial_Distance - Dist_To_Snow
'Call Data Table and Store Data:
CallTable (Table1)
NextScan
EndProg
11. Warnings/Cautions
Never open the SR50A while the sensor is connected to power or any other
device. Always disconnect the SR50A via the connector or disconnect the
cable wires from their termination points.
34