NEC PD78P214 Manuale Utente

Pagina di 487
233
Chapter 8   A/D Converter
8
8.3.3  Scan Mode
In the scan mode, signals input from the analog input pins, specified by bits 1 through 3 (ANI0 through ANI2) of
the A/D converter mode register (ADM), are selected successively for conversion.
For example, when the ANI2 through ANI0 bits of the ADM register are 001, the AN0 and AN1 pins are scanned
repeatedly, starting at the ANI0 pin in the sequence:  AN0 
→ AN1 → AN0 → AN1 →...  In this mode, each time
conversion is completed, the conversion result is stored in the ADCR register, and an A/D conversion end interrupt
request (INTAD) is generated.
Fig. 8-7  Scan Mode Operation Timing
(a)  TRG bit 
 0
AN0
AN1
AN0
AN1
AN0
AN1
A/D
conversion
Conversion starts
    CS
←1
    MS
←0
ANI2-0
←001
Conversion
end
Conversion
end
Conversion
end
Conversion
end
Conversion
end
Conversion
end
AN0
AN1
AN0
AN1
AN0
INTAD
ADCR
(b)  TRG bit 
 1
A/D
conversion
Conversion
end
AN0
Conversion
end
ADCR
Conversion
end
INTAD
Conversion
end
AN1
AN2
AN0
AN0
AN1
AN0
AN0
AN1
AN0
INTP5
Initialization
    CS
←1
    MS
←0
ANI2-0
←010
Conversion starts
Initialization Initialization
Initialization
Cautions 1. When the result of A/D conversion is read by using a vectored interrupt during the scan mode, if the A/D conversion end
interrupt is kept pending for a prolonged time because of other interrupts being handled (at least 180 clocks if the FR bit is 0
or 120 clocks if the FR bit is 1), the conversion result cannot be accurately measured.  To measure the conversion result
accurately, take the following measures:
• Keep the time required to handle other interrupts adequately shorter than the required A/D conversion time.
• Use the multiplexed interrupt mode so that the A/D conversion end interrupt can be accepted even when other interrupts
are being handled.
• Use a macro service to handle the A/D conversion end interrupt.
Note that the A/D conversion end interrupt may also be kept pending by the causes described in Section 12.3.5.
Of the measures described above, the macro service might be the simplest method for you application.