Appendix B. Example programs
CRBasic Example 1: CR300 program using the M! command
'CR300 program that uses the M! command.
Public
CS475A(4)
Alias
CS475A(1) = Stage
'Measured/current stage based on reference conditions
'in sensor
Alias
CS475A(2) = Distance
'Measured distance from the sensor to the water
'surface
Alias
CS475A(3) = Batt_volt_sensor
'This is the voltage seen at the sensor
Alias
CS475A(4) = Error_Code
'error code returned by the sensor.
Units
Stage = ft
'Could be meters based on settings in sensor
Units
Distance = ft
'Could be meters based on settings in sensor
Units
Batt_volt_sensor = V
Units
Error_Code = NA
'unitless
DataTable
(CS475A,1,-1)
Sample
(4,CS475A(),FP2)
EndTable
BeginProg
Scan
(5,Sec,0,0)
'The sensor takes up to 1 s to respond to the M! command in normal power
'mode.
SDI12Recorder
(CS475A,C1,0,
"M!"
,1.0,0,-1)
CallTable
CS475A
NextScan
EndProg
CS475A Radar Water Level Sensor
44