Section 7. Installation
Details of using the SDI12SensorSetup() / SDI12SensorResponse() instruction
pair can be found in the CRBasic Editor Help. Other helpful tips include:
Concerning the Reps parameter in the SDI12SensorSetup(), valid Reps when
expecting an aMx! command range from 0 to 9. Valid Reps when expecting an
aCx! command are 0 to 20. The Reps parameter is not range-checked for valid
entries at compile time. When the SDI-12 recorder receives the sensor response
of atttn to a aMx! command, or atttnn to a aCx! command, only the first digit n,
or the first two digits nn, are used. For example, if Reps is mis-programmed as
123, the SDI-12 recorder will accept only a response of n = 1 when issuing an
aMx! command, or a response of nn = 12 when issuing an aCx! command.
When programmed as an SDI-12 sensor, the CR800 will respond to SDI-12
commands M, MC, C, CC, R, RC, V, ?, and I. See table SDI-12 Commands for
Transparent Mode
(p. 242) for full command syntax. The following rules apply:
1. A CR800 can be assigned only one SDI-12 address per SDI-12 port. For
example, a CR800 will not respond to both 0M! AND 1M! on SDI-12 port
C1. However, different SDI-12 ports can have unique SDI-12 addresses.
Use a separate SlowSequence for each SDI-12 port configured as a sensor.
2. The CR800 will handle additional measurement (aMx!) commands. When an
SDI-12 recorder issues aMx! commands as shown in CRBasic example SDI-
12 Sensor Setup
(p. 254), measurement results are returned as listed in table SDI-
12 Sensor Setup — Results
(p. 255).
SDI-12 Sensor Setup
'This program example demonstrates the use of the SDI12SensorSetup()/SDI12SensorResponse()
'instruction pair to program the CR800 to emulate an SDI-12 sensor. A common use of this
'feature is the transfer of data from the CR800 to SDI-12 compatible instruments, including
'other Campbell Scientific dataloggers, over a single-wire interface (SDI-12 port to
'SDI-12 port). The recording datalogger simply requests the data using the aD0! command.
Public PanelTemp
Public Batt_volt
Public SDI_Source(10)
BeginProg
Scan(5,Sec,0,0)
PanelTemp(PanelTemp,250)
Battery(batt_volt)
SDI_Source(1) = PanelTemp 'temperature, degrees C
SDI_Source(2) = batt_volt 'primary power, volts dc
SDI_Source(3) = PanelTemp * 1.8 + 32 'temperature, degrees F
SDI_Source(4) = batt_volt 'primary power, volts dc
SDI_Source(5) = PanelTemp 'temperature, degrees C
SDI_Source(6) = batt_volt * 1000 'primary power, millivolts dc
SDI_Source(7) = PanelTemp * 1.8 + 32 'temperature in degrees F
SDI_Source(8) = batt_volt * 1000 'primary power, millivolts dc
SDI_Source(9) = Status.SerialNumber 'serial number
SDI_Source(10) = Status.LithiumBattery 'data backup battery, V
NextScan