Capteur de télémétrie sonique SR50A
10.4 Exemple de programmation 4 :
SR50AT SDI-12 « M4! » CR1000 sortie pour l'épaisseur de la neige
'CR1000 Series Datalogger
'The following sample program obtains the Snow depth output
'directly from an SR50AT sensor.
'This program is written for the SR50AT version only. For an SR50A
'sensor a valid depth can not be output unless a temperature value
'is passed from the datalogger to the SR50A via the extended SDI-12 command
'Declare Public Variables
Public
PTemp, batt_volt
Public
SR50ADistanceToGround
'Once the SR50AT is installed the Distance from the SR50AT to the
'Ground must be placed into this parameter. Once successfully transferred
'to the SR50AT the SR50AT will store the parameter in EE memory and retain
'the value even when power is removed.
Public
NewDistanceToGround
Public
SR50AReturnValues(3) as FLOAT
Public
XtendedDistValStr as STRING * 16
Public
ExtendedCMDResult as FLOAT
Alias
SR50AReturnValues(1) = SR50A_SnowDepth_Meters
Alias
SR50AReturnValues(2) = SR50A_QualityVal
Alias
SR50AReturnValues(3) = SR50A_AirTempC
'Declare Other Variables
'Example:
'Dim Counter
Dim
SDI12commandstring as STRING * 16
'Declare Constants
'Example:
'CONST PI = 3.141592654
'Define Data Tables
DataTable
(Test,1,-1)
DataInterval
(0,60,Sec,10)
Minimum
(1,batt_volt,FP2,0,False)
Sample
(1,PTemp,FP2)
Sample
(1,SR50A_SnowDepth_Meters,IEEE4)
Sample
(1,SR50A_QualityVal,FP2)
Sample
(1,SR50A_AirTempC,IEEE4)
EndTable
- 48 -