04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 7. Installation<br />

CRBasic Example 33.<br />

Using Alternate Concurrent Command (aC)<br />

'Code to use when back to back SDI-12 concurrent measurement commands not desired<br />

'Main Program<br />

BeginProg<br />

'Preset first measurement command to C!<br />

For X = 1 To 4<br />

cmd(X) = "C!"<br />

Next X<br />

'Set 5 s scan rate<br />

Scan(5,Sec,0,0)<br />

'Other measurements here<br />

'Set 5 minute measurement rate<br />

If TimeIntoInterval(0,5,Min) Then RunSDI12 = True<br />

'Begin measurement sequence<br />

If RunSDI12 = True Then<br />

For X = 1 To 4<br />

Temp_Tmp(X) = 2e9<br />

Next X<br />

'when 2e9 changes, indicates a change<br />

'Measure SDI-12 sensors<br />

SDI12Recorder(Temp_Tmp(1),1,0,cmd(1),1.0,0)<br />

SDI12Recorder(Temp_Tmp(2),1,1,cmd(2),1.0,0)<br />

SDI12Recorder(Temp_Tmp(3),1,2,cmd(3),1.0,0)<br />

SDI12Recorder(Temp_Tmp(4),1,3,cmd(4),1.0,0)<br />

'Control Measurement Event<br />

For X = 1 To 4<br />

If cmd(X) = "C!" Then Retry(X) = Retry(X) + 1<br />

If Retry(X) > 2 Then IndDone(X) = -1<br />

'Test to see if ttt expired. If ttt not expired, load "1e9" into first<br />

'variable then moves to next instruction. If ttt expired, issue<br />

'aDv! command(s).<br />

If ((Temp_Tmp(X) = 2e9) OR (Temp_Tmp(X) = 1e9)) Then<br />

cmd(X) = "C"<br />

'Start sending "C" command.<br />

ElseIf(Temp_Tmp(X) = NAN) Then<br />

cmd(X) = "C!"<br />

'Comms failed or sensor not attached<br />

'Start measurement over<br />

181

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!