Chapter 6 A/D Conversion Functions
115
A/D Conversion
6-2 A/D Conversion
The procedures for operating the A/D conversion circuit are listed below.
(1) Set the ANCHS2 to ANCHS0 flags of A/D control register 0 (ANCTR0) to specify one
of pins AN7 to AN0 (PA7 to PA0) as the analog input.
(2) Set the ANCK1 and ANCK0 flags of A/D control register 0 to select the A/D
conversion clock. Make this setting such that the period of the conversion clock
(TAD), which is based on the oscillator, is greater than 800ns.
(3) With the ANSH1 and ANSH0 flags of A/D control register 0, set the sample-and-hold
time. Select a value for the sample and hold time that is suitable for the analog input
impedance.
(4) Set the ANLADE flag of A/D control register 0 to "1" so that current flows through
the ladder resistors and the A/D converter is on standby.
Note: Steps 1 to 4 above may performed all at the same time.
(5) Set the ANST flag of A/D control register 1 (ANCTR1) to "1" to start the A/D
conversion.
(6) After the sample-and-hold time set in step 3, the sampled A/D conversion data is
sequentially compared to determine its value beginning with the MSB.
(7) When the A/D conversion is complete, the ANST bit is cleared to "0" and conversion
results are stored in A/D buffers (ANBUF0, 1). At the same time, an A/D complete
interrupt request (ADIRQ) is generated.
Figure 6-2-1 A/D Conversion Timing
Start the A/D conversion after the
current flowing through the ladder
resistors stabilizes. The time
constant calculated time from the
ladder resistance (max. 80 k
Ω
)
and the external bypass capacitor
connected between V
dd
and V
ss
should be used as the criteria for
the wait time.
TAD
1~2 3 4 12
ANST
A/D conversion start
TS
Hold
Sampling
Bit 9
comparison
Bit 8
comparison
Bit 0
comparison
Determine
bit 1 value
Determine
bit 8 value
Determine
bit 9 value
A/D interrupt
Determine
bit 0 value
A/D conversion complete