Advantech Carbon Monoxide Alarm PCI-1718 Series User Manual

Page of 94
67
Appendix C  
C.6  MUX Scan Channel Control — BASE+02H
The write register at BASE+02H controls multiplexer (MUX) scanning. 
The high nibble provides the stop scan channel number, and the low nib-
ble provides the start scan channel number. Writing to this register auto-
matically initializes the MUX to the start channel. Each A/D conversion 
trigger sets the MUX to the next channel.
With continuous triggering the MUX will scan from the start channel to 
the end channel, then repeat. For example, if the start channel is 3 and the 
stop channel is 7, then the scan sequence is 3, 4, 5, 6, 7, 3, 4, 5, 6, 7, 3, 4.
CH3 ~ CH0 
Stop scan channel number
CH0 
The least significant bit (LSB) of the stop channel
CH3 
The most significant bit (MSB)
CL3 ~ CL0 
Start scan channel number
CL0 
The least significant bit (LSB) of the start channel
CL3 
The most significant bit (MSB)
The MUX scan register low nibble, CL3 to CL0, also acts as a pointer 
when you program the A/D input range (see previous section). When you 
set the MUX start channel to N, the range code written to the register 
BASE+01H is for channel N.
Programming example for PCI-1718HDU
This BASIC code fragment sets the range for channel 5 to ±0.625 V:
200  OUT BASE+2, 5   'SET POINTER TO CH.5
210  OUT BASE+1, 3   'RANGE CODE=3 FOR ±0.625 V
Table C.7: Register for MUX Scan Channel Control
Write
MUX scan channel control
Bit  #
7
6
5
4
3
2
1
0
BASE + 02H
CH3
CH2
CH1
CH0
CL3
CL2
CL1
CL0
Note:
The MUX start/stop channel changes each time 
you change the input range. Do not forget to reset 
the MUX start and stop channels to the correct 
values after you finish setting the range.