SR50A Sonic Ranging Sensor
- 43 -
'Read the snow depth from the SR50A "M!" command depths
SDI12Recorder(RawDist(SR50ACount),1,0,"M!",1.0,0)
'Correct Distance for Temperature
CorDist(SR50ACount)=RawDist(SR50ACount)*(SQR((AirTC+273.15)/273.15))
'Increment counter to ensure proper allocation to array of measurements
SR50ACount = SR501
If SR50ACount = 12 Then
'Sort the values
SortSpa(SR50ASort(),11,CorDist())
'Take the Median value as distance to snow
Distance=SR50ASort(6)
'Calculate snow depth
SnowDepth=Dist2Gnd-Distance
'Measurements complete and median chosen, reset values in anticipation of next scan.
SR50AMeasureFlag=false
SR50ACount = 1
EndIf
EndIf
'Call Data Tables and Store Data
CallTable(Hourly)
CallTable (Daily)
NextScan
EndProg
10 Datalogger Program examples
In the following datalogger program examples only the CR1000 and the
CR10X dataloggers are used. The programming of CR800, CR850 and
the CR3000 dataloggers are effectively the same as the CR1000. Also
for a CR23X datalogger refer to the CR10X programming examples.
10.1 Programming Example 1
SR50A SDI-
12 “M1!” CR10X Datalogger
;{CR10X}
;
;In this example, the SR50A is mounted 2.5 meters above the ground.
;The CR10X sends an SDI-12 command to the SR50A, which outputs a
;non-temperature compensated distance value (Raw_Dist) and signal quality value.
;Two input locations are used to store incoming data.
*Table 1 Program
01: 60 Execution Interval (seconds)
;Measure the 107 temperature probe:
1: Temp (107) (P11)
1: 1 Reps
2: 1 SE Channel ;SE channel 1 used for this example