Datasheet
78K0/Ix2 CHAPTER 11 A/D CONVERTER
R01UH0010EJ0500 Rev.5.00 386
Feb 28, 2012
11.4.2 Basic operation of A/D converter (timer trigger mode)
<1> Set the A/D conversion time and the operation mode by using bits 5 to 1 (FR2 to FR0, LV1, and LV0) of the A/D
converter mode register 0 (ADM0).
<2> Set bit 0 (ADCE) of ADM0 to 1 to start the operation of the A/D voltage comparator.
<3> Set channels for A/D conversion to analog input by using the A/D port configuration registers 0 and 1 (ADPC0,
ADPC1) and set to input mode by using port mode registers 2 and 7 (PM2, PM7).
<4> Set the PGA operation to set the PGA output and the single Amp operation to set the operational amplifier output
for analog input. (refer to CHAPTER 12 OPERATIONAL AMPLIFIER).
<5> Select TMX0 or TMX1 synchronization by using bits 4 and 5 (ADTRG0, ADTRG1) of the analog input channel
specification register (ADS).
<6> Select one channel for A/D conversion by using the analog input channel specification register (ADS).
<7> Set the timer trigger wait state by setting (1) bit 7 (ADCS) of ADM0.
(<8> to <16> are operations performed by hardware.)
<8> A conversion operation is started when a trigger signal (TMX0 or TMX1 output) is detected.
<9> The voltage input to the selected analog input channel is sampled by the sample & hold circuit.
<10> When sampling has been done for a certain time, the sample & hold circuit is placed in the hold state and the
sampled voltage is held until the A/D conversion operation has ended.
<11> Bit 9 of the successive approximation register (SAR) is set. The comparison voltage generator outputs (1/2)
AV
REF voltage.
<12> The voltage difference between the output voltage of the comparison voltage generator and sampled voltage is
compared by the voltage comparator. If the analog input is greater than (1/2) AV
REF, the MSB of SAR remains
set to 1. If the analog input is smaller than (1/2) AVREF, the MSB is reset to 0.
<13> Next, bit 8 of SAR is automatically set to 1, and the operation proceeds to the next comparison. The output
voltage of the comparison voltage generator is selected according to the preset value of bit 9, as described below.
Bit 9 = 1: (3/4) AV
REF
Bit 9 = 0: (1/4) AV
REF
The output voltage of the comparison voltage generator and sampled voltage are compared and bit 8 of SAR is
manipulated as follows.
Analog input voltage Output voltage of comparison voltage generator: Bit 8 = 1
Analog input voltage < Output voltage of comparison voltage generator: Bit 8 = 0
<14> Comparison is continued in this way up to bit 0 of SAR.
<15> Upon completion of the comparison of 10 bits, an effective digital result value remains in SAR, and the result
value is transferred to the A/D conversion result register (TMX0 synchronization: ADCRX0, ADCRX0L, TMX1
synchronization: ADCRX1, ADCRX1L) and then latched.
At the same time, the A/D conversion end interrupt request (INTAD) can also be generated.
<16> Repeat steps <9> to <15>, until ADCS is cleared to 0.
To stop the A/D converter, clear ADCS to 0.
To restart A/D conversion from the status of ADCE = 1, start from <7>. To start A/D conversion again when
ADCE = 0, set ADCE to 1, wait for 1
s or longer, and start <7>. To change a channel of A/D conversion, start
from <6>.