![](http://datasheet.mmic.net.cn/370000/UPD17134ACT-xxx_datasheet_16740627/UPD17134ACT-xxx_148.png)
CHAPTER 13 PERIPHERAL HARDWARE
129
13.3.2 Functions of A/D Converter
(1) ADC
0
– ADC
3
These pins are used to input 4-channel analog voltage to the A/D converter. The A/D converter contains a
sample hold circuit. Analog input voltage is internally retained during A/D conversion.
(2) V
ADC
This pin is used to input the power supply and the reference voltage for the A/D converter.
A signal input to ADC
0
to ADC
3
is converted to a digital signal based on voltage applied across V
ADC
and GND.
To reduce the current consumption of the microcontroller, the A/D converter has a function for automatically
stopping the current which flows into the V
ADC
pin when the converter is not operating. Current flows into the
V
ADC
pin in the following cases.
<1>
Successive mode (ADCSOFT=0)
From when the ADCSTRT flag is set (1) until the ADCEND flag is set (1).
Single mode (ADCSOFT=1)
From when the ADCSTRT flag is set (1) or from when a value of the 8-bit data register is written until
the result of comparison by the comparator is written in the ADCCMP flag.
<2>
Caution If the HALT Instruction is executed while the A/D conversion is in progress, the A/D
converter stops conversion. Note that, in this case, the HALT mode is set with current
flowing to the V
ADC
pin. When the HALT mode has been released, the A/D conversion
is resumed. At this time, however, the value of ADCR is undefined, and the correct
conversion result cannot be obtained.
Remark
A/D conversion is stopped if the STOP instruction is executed while the conversion is in
progress. In this case, the A/D converter is initialized, and the current to the V
ADC
pin is also
cut. The A/D converter remains stopped even if the STOP mode has been released.
(3) 8-bit data register (ADCR)
In the successive mode, this 8-bit data register stores A/D conversion results for successive approximation.
It is read by the GET instruction. In the single mode, the data in this register is converted to analog voltage
by the internal D/A converter and the comparator compares this voltage with an analog signal input from the
ADCn pin. A value can be written in this register by using the PUT instruction.
(4) Comparator
The comparator compares an analog input voltage from a pin with voltage output from the D/A converter. Value
1 is output if analog input voltage from the pin is high. Value 0 is output if this voltage is low. The comparison
result is stored in the 8-bit data register (ADCR) in the successive mode. It is stored in the ADCCMP flag in
the single mode.
(5) A/D converter control register
Figure 13-14 shows the A/D converter control register.