English
Language : 

PIC18F87K22 Datasheet, PDF (365/548 Pages) Microchip Technology – 64/80-Pin, High-Performance, 1-Mbit Enhanced Flash Microcontrollers with 12-Bit A/D and nanoWatt XLP Technology
PIC18F87K22 FAMILY
24.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 and can also be
read through the control register. Multiple output and
interrupt event generation are also available. A generic
single comparator from the module is shown in
Figure 24-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
24.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 24-1).
The CMSTAT register (Register 24-2) provides the out-
put results of the comparators. The bits in this register
are read-only.
FIGURE 24-1:
COMPARATOR SIMPLIFIED BLOCK DIAGRAM
CCH<1:0>
CxINB
0
CxINC(2)
1
C2INB/C2IND(1,2)
2
VBG
3
CREF
CxINA
0
CVREF
1
VIN-
VIN+ Cx
CON
Interrupt
Logic
EVPOL<1:0>
Polarity
Logic
COE
CPOL
CMPxOUT
(CMSTAT<7:5>)
CMPxIF
CxOUT
Note 1:
2:
Comparators, 1 and 3, use C2INB as an input to the inverting terminal. Comparator 2 uses C2IND as an input to
the inverted terminal.
C1INC, C2INC and C2IND are all unavailable for 64-pin devices (PIC18F6XK22).
 2010 Microchip Technology Inc.
Preliminary
DS39960B-page 365