beautypg.com

2 programming, 1 control the multiplexer, 1 crbasic – Campbell Scientific 223-L Delmhorst Cylindrical Soil Moisture Block User Manual

Page 15: Programming, Control the multiplexer, Crbasic

background image

223 Delmhorst Cylindrical Soil Moisture Block

7.2 Programming

This section describes using CRBasic or Edlog to program the
datalogger. See Section 4.2, Use SCWin to Program Datalogger
and Generate Wiring Diagram
, if using Short Cut.

NOTE

Dataloggers that use CRBasic include our CR800, CR850, CR1000, CR3000,
and CR5000. Dataloggers that use Edlog include our CR10(X), 21X, CR23X,
and CR7. CRBasic and Edlog are included with LoggerNet, PC400, and
RTDAQ software.

The datalogger program needs to control the multiplexer, measure the sensor,
calculate the sensor resistance, and convert the resistance to potential in bars.
Example programs are provided in Section 7.2.5, Example Programs.

7.2.1 Control the Multiplexer

When a multiplexer is used, the measurements are placed within a loop. Each
pass through the loop, the multiplexer is clocked to the next channel and the
sensors connected to that channel are measured. The programming sequence
for using the multiplexer is shown in Section 7.2.1.1, CRBasic, and Section
7.2.1.2, Edlog. For more information, see the multiplexer manual.

7.2.1.1 CRBasic

The generalized CRBasic programming sequence follows:

ACTIVATE MULTIPLEXER/RESET INDEX

Portset (1 ,1)

'Set C1 high to Enable Multiplexer

I=0

BEGIN MEASUREMENT LOOP

SubScan (0,sec,16)

'This example measures 16 sets

CLOCK PULSE AND DELAY

Portset (2,1)

‘Set port 2 high

Delay

(0,20,mSec)

Portset

(2,0)

‘Set port 2 low

INCREMENT INDEX AND MEASURE
I=I+1

‘223 measurement instruction

‘Storing results in Variable(I)

END MEASUREMENT LOOP
NextSubScan

DEACTIVATE MULTIPLEXER
Portset

(1

,0)

'Set C1 Low to disable Multiplexer

9