Campbell Scientific AM16/32B AM16/32B Relay Multiplexer - Page 23

CRBasic P, rogramming

Page 23 highlights

AM16/32B Relay Multiplexer 5.1 CRBasic Programming 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 measurement loop. The program must also specifically increment an index variable and use that 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 MEASUREMENT LOOP SubScan(0,sec,16) '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 'User specified measurement 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: PortSet( Port, State ) Where, Port: the datalogger control port being used. State: 0 = Set port low; Non-zero = Set port high. NOTE 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: SubInterval: constant that designates the time interval between subscans. Enter 0 for no delay between subscans. 13

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

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