Hardware manual
Rev. 3.0, 09/98, page 237 of 361
11.3.2 Scan Mode (SCAN = 1)
The scan mode can be used to monitor analog inputs on one or more channels. When the ADST
bit is set to “1,” either by software or by a High-to-Low transition of the ADTRG signal (if
enabled), A/D conversion starts from the first channel selected by the CH bits. When CH2 = “0”
the first channel is AN
0
. When CH2 = “1” the first channel is AN
4
.
If the scan group includes more than one channel (i.e., if bit CH1 or CH0 is set), conversion of the
next channel (AN
1
or AN
5
) begins as soon as conversion of the first channel ends.
Conversion of the selected channels continues cyclically until the ADST bit is cleared to “0.” The
conversion results are placed in the data registers corresponding to the selected channels. The A/D
data registers are readable by the CPU.
Before selecting the scan mode, clock, and analog input channels, software should clear the ADST
bit to “0” to make sure the A/D converter is stopped. Changing the mode, clock, or channel
selection while A/D conversion is in progress can lead to conversion errors. A/D conversion
begins from the first selected channel when the ADST bit is set to “1” again. The same instruction
can be used to alter the mode and channel selection and set ADST to “1.”
The following example explains the A/D conversion process when three channels in group 0 are
selected (AN
0
, AN
1
, and AN
2
) and the external trigger is disabled. Figure 11.3 shows the
corresponding timing chart.
(1) Software clears the ADST bit to “0,” then selects the scan mode (SCAN = “1”), scan group 0
(CH2 = “0”), and analog input channels AN
0
to AN
2
(CH1 = “1” and CH0 = “0”) and sets the
ADST bit to “1” to start A/D conversion.
Coding Example: (with slow clock and ADI interrupt enabled)
BCLR #5, @H'FFE8 ;Clear ADST
MOV.B #H'7F, ROL
MOV.B ROL, @H'FFEA ;Disable external trigger
MOV.B #H'72, ROL
MOV.B ROL, @H'FFE8 ;Select mode and channels and set ADST to “1”
Value set in ADCSR
ADF ADIE ADST SCAN CKS CH2 CH1 CH0
01110010
(2) The A/D converter converts the voltage level at the AN0 input pin to a digital value, and
transfers the result to register ADDRA.
(3) Next the A/D converter converts AN1 and transfers the result to ADDRB. Then it converts
AN2 and transfers the result to ADDRC.