
1996 Jan 08
15
Philips Semiconductors
Preliminary specification
Microcontroller for monitor OSD
and auto-sync applications
PCE84C882
8
ANALOG-TO-DIGITAL CONVERTER (ADC)
The single channel ADC comprises a 4-bit
Digital-to-Analog Converter (DAC); a comparator; an
analog channel selector and control circuitry. As the digital
input to the 4-bit DAC is loaded by software (a subroutine
in the program), it is known as a software ADC. The block
diagram is shown in Fig.12.
The ADC input ADC2, shares the same pin as Derivative
Port line DP12. Selection of the pin function as either an
ADC input or as a Derivative Port line is achieved using bit
ADCE2 in Register 22. When ADCE2 = 1, the ADC
function is enabled (see Section 12.1).
The ADC channel selector is controlled by the ADCS1 and
ADCS0 bits in Register 20. As the PCE84C882 provides
only one ADC channel, ADCS1 bit must be set to a logic 1
and ADCS0 bit must be set to a logic 0. All other settings
are invalid.
The 4-bit DAC analog output voltage (V
ref
) is determined
by the decimal value of the data held in bits DAC0 to DAC3
of Register 20. V
ref
is calculated as shown in Equation (3)
and Table 4 lists the V
ref
values assuming V
DD
= 5 V.
V
16
(3)
When the analog input voltage is higher than V
ref
, the
COMP bit in Register 20 will be HIGH.
Table 4
Selection of V
ref
DAC3
DAC2
DAC1
DAC0
V
ref
(V)
0.3125
0.6250
0.9375
1.2500
1.5625
1.8750
2.1875
2.5000
2.8125
3.1250
3.4375
3.7500
4.0625
4.3750
4.6875
5.0000
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
V
ref
----------
DAC value
1
+
(
)
×
=
8.1
Conversion algorithm
There are many algorithms available to achieve the ADC
conversion. The algorithm described below and shown in
Fig.13 uses an iteration process.
1.
Enable and then select the ADC2 channel for
conversion. Channel selection is achieved using bits
ADCS1 and ADCS0 in Register 20.
2.
Set the digital input to the DAC to 1000. The digital
input to the DAC is selected using bits DAC3 to DAC0
in Register 20.
3.
Determine the result of the compare operation. This is
achieved by reading the COMP bit in Register 20
using the instruction MOV A, D20. If COMP = 1; the
analog input voltage is higher than the reference
voltage (V
ref
). If COMP = 0; the analog input voltage is
lower than the reference voltage (V
ref
).
4.
If COMP = 1; then the analog input voltage is higher
than the reference voltage (V
ref
) and therefore the
digital input to the DAC needs to be increased. Set the
input to the DAC to 1100.
5.
If COMP = 0; then the analog input voltage is lower
than the reference voltage (V
ref
) and therefore the
digital input to the DAC needs to be decreased. Set the
input to the DAC to 0100.
6.
Determine the result of the compare operation by
reading the COMP bit in Register 20.
7.
For the DAC = 1100 case
If COMP = 1; then the analog input voltage is still
greater than V
ref
and therefore the digital input to the
DAC needs to be increased again. Set the input to the
DAC to 1110.
If COMP = 0; then the analog input voltage is now less
than V
ref
and therefore the digital input to the DAC
needs to be decreased. Set the input to the DAC to
1010
8.
For the DAC = 0100 case
If COMP = 1; then the analog input voltage is now
greater than V
ref
and therefore the digital input to the
DAC needs to be increased. Set the input to the DAC
to 0110.
If COMP = 0; then the analog input voltage is still lower
than V
ref
and therefore the digital input to the DAC
needs to be decreased again. Set the input to the DAC
to 0010.