
Chapter 13 A/D Converter
Operation
XIII - 8
13-3
Operation
Here is a description of A/D converter circuit setup procedure.
(1)
Set the analog pins.
Set the analog input pin, set in (2), to "special function pin" by the port A input mode register
(PAIMD).
* Setup of the port A input mode register should be done before analog voltage is put to pins.
(2)
Select the analog input pin.
Select the analog input pin from AN7 to AN0 (PA7 to PA0) by the ANCHS2 to ANCHS0 flag of
the A/D converter control register 1 (ANCTR1).
(3)
Select the A/D converter clock.
Select the A/D converter clock by the ANCK1, ANCK0 flag of the A/D converter control
register 0 (ANCTR0).
Setup should be such a way that converter clock (TAD) does not drop less than 800 ns with any
oscillator.
(4)
Set the sample hold time.
Set the sample hold time by the ANSH1, ANSH0 flag of the A/D converter control register 0
(ANCTR0). The sample hold time should be based on analog input impedance.
(5)
Set the A/D ladder resistance.
Set the ANLADE flag of the A/D converter control register 0 (ANCTR0) to "1", and a current
flow through the ladder resistance and A/D converter goes into the waiting.
* (2) to (5) are not in order. (3), (4) and (5) can be operated simultaneously.
(6)
Select the A/D converter activation factor, then start A/D conversion.
Set the ANST flag of the A/D converter control register 2 (ANCTR2) to "1" to start A/D
converter.
(7)
A/D conversion
After sampling with the sample and hold time, set in (3), A/D conversion is decided in
comparison with MSB, in order.
(8)
Complete the A/D conversion.
When A/D conversion is finished, the ANST flag is cleared to "0", and the result of the
conversion is stored to the A/D buffer (ANBUF0, 1). At the same time, the A/D complete
interrupt request (ADIRQ) is generated.