PIC16F87XA
12.3.2
INTERNAL REFERENCE SIGNAL
12.2 Comparator Operation
The comparator module also allows the selection of an
internally generated voltage reference for the
comparators. Section 13.0 contains a detailed descrip-
tion of the Comparator Voltage Reference Module that
provides this signal. The internal reference signal is
used when comparators are in mode CM<2:0> = 110
(Figure 12-1). In this mode, the internal voltage refer-
ence is applied to the VIN+ pin of both comparators.
A single comparator is shown in Figure 12-2 along with
the relationship between the analog input levels and
the digital output. When the analog input at VIN+ is less
than the analog input VIN–, the output of the
comparator is a digital low level. When the analog input
at VIN+ is greater than the analog input VIN–, the output
of the comparator is a digital high level. The shaded
areas of the output of the comparator in Figure 12-2
represent the uncertainty due to input offsets and
response time.
12.4 Comparator Response Time
Response time is the minimum time, after selecting a
new reference voltage or input source, before the
comparator output has a valid level. If the internal ref-
erence is changed, the maximum delay of the internal
voltage reference must be considered when using the
comparator outputs. Otherwise, the maximum delay of
the comparators should be used (Section 17.0).
12.3 Comparator Reference
An external or internal reference signal may be used
depending on the comparator operating mode. The
analog signal present at VIN– is compared to the signal
at VIN+, and the digital output of the comparator is
adjusted accordingly (Figure 12-2).
12.5 Comparator Outputs
FIGURE 12-2:
SINGLE COMPARATOR
The comparator outputs are read through the CMCON
Register. These bits are read only. The comparator
outputs may also be directly output to the RA4 and RA5
I/O pins. When enabled, multiplexors in the output path
of the RA4 and RA5 pins will switch and the output of
each pin will be the unsynchronized output of the com-
parator. The uncertainty of each of the comparators is
related to the input offset voltage and the response time
given in the specifications. Figure 12-3 shows the com-
parator output block diagram.
VIN+
VIN–
+
Output
–
VIN–
V
IN–
The TRISA bits will still function as an output
enable/disable for the RA4 and RA5 pins while in this
mode.
VIN+
V
IN+
The polarity of the comparator outputs can be changed
using the C2INV and C1INV bits (CMCON<4:5>).
Output
utput
Note 1: When reading the PORT register, all pins
configured as analog inputs will read as a
‘0’. Pins configured as digital inputs will
convert an analog input, according to the
Schmitt Trigger input specification.
12.3.1
EXTERNAL REFERENCE SIGNAL
When external voltage references are used, the
comparator module can be configured to have the com-
parators operate from the same, or different reference
sources. However, threshold detector applications may
require the same reference. The reference signal must
be between VSS and VDD, and can be applied to either
pin of the comparator(s).
2: Analog levels on any pin defined as a dig-
ital input, may cause the input buffer to
consume more current than is specified.
3: RA4 is an open collector I/O pin. When
used as an output, a pull-up resistor is
required.
2001 Microchip Technology Inc.
Advance Information
DS39582A-page 135