Section 7. Installation
182
CRBasicExample33. UsingAlternateConcurrentCommand(aC)
'Code to use when back to back SDI-12 concurrent measurement commands not desired
'Main Program
BeginProg
'Preset first measurement command to C!
For X = 1 To 4
cmd(X) = "C!"
Next X
'Set 5 s scan rate
Scan(5,Sec,0,0)
'Other measurements here
'Set 5 minute measurement rate
If TimeIntoInterval(0,5,Min) Then RunSDI12 = True
'Begin measurement sequence
If RunSDI12 = True Then
For X = 1 To 4
Temp_Tmp(X) = 2e9 'when 2e9 changes, indicates a change
Next X
'Measure SDI-12 sensors
SDI12Recorder(Temp_Tmp(1),1,0,cmd(1),1.0,0)
SDI12Recorder(Temp_Tmp(2),1,1,cmd(2),1.0,0)
SDI12Recorder(Temp_Tmp(3),1,2,cmd(3),1.0,0)
SDI12Recorder(Temp_Tmp(4),1,3,cmd(4),1.0,0)
'Control Measurement Event
For X = 1 To 4
If cmd(X) = "C!" Then Retry(X) = Retry(X) + 1
If Retry(X) > 2 Then IndDone(X) = -1
'Test to see if ttt expired. If ttt not expired, load "1e9" into first
'variable then moves to next instruction. If ttt expired, issue
'aDv! command(s).
If ((Temp_Tmp(X) = 2e9) OR (Temp_Tmp(X) = 1e9)) Then
cmd(X) = "C" 'Start sending "C" command.
ElseIf(Temp_Tmp(X) = NAN) Then 'Comms failed or sensor not attached
cmd(X) = "C!" 'Start measurement over