Microchip Technology IC MCU 8BIT PIC18F65K22-I/PT TQFP-64 MCP PIC18F65K22-I/PT Data Sheet

Product codes
PIC18F65K22-I/PT
Page of 550
 2009-2011 Microchip Technology Inc.
DS39960D-page 367
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 Reference Voltages. 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
.
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 
).
The CMSTAT register (
) provides the out-
put results of the comparators. The bits in this register
are read-only. 
FIGURE 24-1:
COMPARATOR SIMPLIFIED BLOCK DIAGRAM         
Cx
V
IN
-
V
IN
+
COE
CxOUT 
0
1
2
3
0
1
CCH<1:0>
CxINB
CxINC
(2)
C2INB/C2IND
(1,2)
V
BG
CxINA
CV
REF
CON
Interrupt
Logic
EVPOL<1:0> 
CMPxOUT
(CMSTAT<7:5>)
CMPxIF 
CPOL 
Polarity
Logic
CREF
Note
1:
Comparators, 1 and 3, use C2INB as an input to the inverting terminal. Comparator 2 uses C2IND as an input to 
the inverted terminal.
2:
C1INC, C2INC and C2IND are all unavailable for 64-pin devices (PIC18F6XK22).