3 cr10x example (sdi-12 “m3!”) – Campbell Scientific SR50A Distance Sensor User Manual
Page 39
![background image](/manuals/416103/39/background.png)
SR50A Sonic Ranging Sensor
'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
10.2.3 CR10X Example (SDI-12 “M3!”)
;{CR10X}
;
;In this example, the SR50AT is mounted 2.5 meters above the ground.
;
;The CR10X sends an SDI-12 command to the SR50AT, which outputs the
;temperature compensated distance value (Meters),
;the signal quality value and the temperature.
;
;Three input locations are used to store incoming data.
*Table 1 Program
01: 60
Execution
Interval
(seconds)
;Use SDI-12 command "M3!" to receive Distance, Signal Quality and Temperature
1: SDI-12 Recorder (P105)
1: 0
SDI-12
Address
2: 3
Start
Measurement
(aM3!)
3: 1
Port
;Use Ports 5-8 for CR23X
4: 3
Loc
[
SR50ATDIS
]
5: 1.0
Multiplier
6: 0.0
Offset
;Set the initial distance from the SR50A to the ground in meters:
2: Z=F x 10^n (P30)
1: 2.5
F
2: 00
n,
Exponent
of
10
3: 2
Z Loc [ DisToGnd ]
;Subtract the Distance to the snow surface from the Distance to Ground
;to obtain snow depth
3: Z=X-Y (P35)
1: 2
X Loc [ DisToGnd ]
2: 3
Y Loc [ SR50ATDIS ]
3: 6
Z Loc [ SnowDepth ]
;Hourly Data Output
4: If time is (P92)
1: 0
Minutes (Seconds --) into a
2: 60
Interval (same units as above)
3: 10
Set Output Flag High (Flag 0)
5: Set Active Storage Area (P80)^27063
1: 1
Final
Storage
Area
1
2: 60
Array
ID
33