beautypg.com

1 crbasic programming, Crbasic programming, 1 crbasic p – Campbell Scientific AM16/32B Relay Multiplexer User Manual

Page 23: Rogramming

background image

AM16/32B Relay Multiplexer

5.1 CRBasic P

rement loop. The

program must also specifically increment an index variable and use that

ASUREMENT LOOP

SubScan(0,sec,16) 'Measures 16 sets

ELAY

) ‘Set port 2 high

easurement

instruction

‘Storing

results

in

Variable(I)

END MEASUREMENT LOOP
NextSubScan
DEACTIVATE MULTIPLEXER
Portset

(1

,0)

'Set C1 Low to disable Multiplexer

The CRBasic instructions used to program the multiplexer are described below.

PortSet Syntax:

rogramming

The CR5000, CR800, CR850, CR3000, and CR1000 are programmed with
CRBasic. The PortSet() instruction enables or disables the multiplexer and the
SubScan()/NextSubScan instruction begins/ends the measu

variable to determine where each measurement is stored. The generalized
CRBasic programming sequence follows:

ACTIVATE MULTIPLEXER/RESET INDEX
Portset

(1

,1)

'Set C1 high to Enable Multiplexer

I=0

BEGIN ME

CLOCK PULSE AND D
Portset

(2,1

Delay

(0,20,mSec)

Portset

(2,0)

‘Set port 2 low

INCREMENT INDEX AND MEASURE
I=I+1
'User

specified

m

PortSet(

Port

,

State

)

Where,

Port: the datalogger control port being used.

State: 0 = Set port low;

Non-zero = Set port high.

PortSet must appear within a Scan/NextScan loop or a compiler
error will occur. This instruction must NOT be placed inside a
conditional statement when running in pipeline mode.

SubScan/NextSubScan Syntax:
SubScan (

SubInterval

,

Units

,

Count

)

NextSubScan

Where:

ns.

Enter 0 for no delay between subscans.

NOTE

SubInterval: constant that designates the time interval between subsca

13