Datasheet

2012 Microchip Technology Inc. DS30575A-page 489
PIC18F97J94 FAMILY
23.0 COMPARATOR MODULE
The analog comparator module contains three compar-
ators that can be independently configured in a variety
of ways. The inputs can be selected from the analog
inputs and two internal voltage references. The digital
outputs are available at the pin level, via PPS-Lite, and
can also be read through the control register. Multiple
output and interrupt event generations are also avail-
able. A generic single comparator from the module is
shown in Figure 23-1.
Key features of the module includes:
Independent comparator control
Programmable input configuration
Output to both pin and register levels
Programmable output polarity
Independent interrupt generation for each
comparator with configurable interrupt-on-change
23.1 Registers
The CMxCON registers (CM1CON, CM2CON and
CM3CON) select the input and output configuration for
each comparator, as well as the settings for interrupt
generation (see Register 23-1).
The CMSTAT register (Register 23-2) provides the out-
put results of the comparators. The bits in this register
are read-only.
FIGURE 23-1: COMPARATOR SIMPLIFIED BLOCK DIAGRAM
Cx
VIN-
V
IN+
COE
CxOUT
0
1
2
0
1
CCH<1:0>
CxINB
CxINC
C2INB/C2IND
(1)
CxINA
CV
REF
CON
Interrupt
Logic
EVPOL<1:0>
CxOUT
(CMSTAT<2:0>)
CMPxIF
CPOL
Polarity
Logic
CREF
3
V
BG
Note 1: Comparator 1 and Comparator 3 use C2INB as an input to the inverted terminal. Comparator 2 uses C2IND as an
input to the inverted terminal.