PIC18F45J10 FAMILY
changed, the comparator output level may not be valid
for the specified mode change delay shown in
Section 24.0 “Electrical Characteristics”.
19.1 Comparator Configuration
There are eight modes of operation for the compara-
tors, shown in Figure 19-1. Bits, CM<2:0> of the
CMCON register, are used to select these modes. The
TRISA register controls the data direction of the com-
parator pins for each mode. If the Comparator mode is
Note:
Comparator interrupts should be disabled
during Comparator mode change;
otherwise, a false interrupt may occur.
a
FIGURE 19-1:
COMPARATOR I/O OPERATING MODES
Comparators Reset
Comparators Off (POR Default Value)
CM<2:0> = 000
CM<2:0> = 111
A
D
VIN-
VIN-
RA0/AN0
RA0/AN0
Off (Read as ‘0’)
Off (Read as ‘0’)
Off (Read as ‘0’)
Off (Read as ‘0’)
C1
C2
C1
C2
VIN+
VIN+
A
D
RA3/AN3/
VREF+
RA3/AN3/
VREF+
A
D
VIN-
VIN-
RA1/AN1
RA1/AN1
VIN+
VIN+
A
D
RA2/AN2/
VREF-/CVREF
RA2/AN2/
VREF-/CVREF
Two Independent Comparators
Two Independent Comparators with Outputs
CM<2:0> = 010
CM<2:0> = 011
A
A
VIN-
VIN-
RA0/AN0
RA0/AN0
C1OUT
C2OUT
C1OUT
C2OUT
C1
C2
C1
C2
VIN+
VIN+
A
A
RA3/AN3/
VREF+
RA3/AN3/
VREF+
RB5/KBI1/
T0CKI/C1OUT*
A
A
VIN-
RA1/AN1
RA2/AN2/
A
VIN-
RA1/AN1
VIN+
VIN+
A
RA2/AN2/
VREF-/CVREF
VREF-/CVREF
RA5/AN4/SS1/C2OUT*
Two Common Reference Comparators
Two Common Reference Comparators with Outputs
CM<2:0> = 100
CM<2:0> = 101
A
A
VIN-
VIN-
RA0/AN0
RA0/AN0
C1OUT
C2OUT
C1OUT
C2OUT
C1
C2
C1
C2
VIN+
VIN+
A
A
RA3/AN3/
VREF+
RA3/AN3/
VREF+
RB5/KBI1/
T0CKI/C1OUT*
A
D
VIN-
RA1/AN1
RA2/AN2/
A
VIN-
RA1/AN1
VIN+
VIN+
D
RA2/AN2/
VREF-/CVREF
VREF-/CVREF
RA5/AN4/SS1/C2OUT*
Four Inputs Multiplexed to Two Comparators
One Independent Comparator with Output
CM<2:0> = 110
CM<2:0> = 001
A
A
A
VIN-
RA0/AN0
RA0/AN0
CIS = 0
CIS = 1
VIN-
A
C1OUT
C1
VIN+
RA3/AN3/
VREF+
RA3/AN3/
VREF+
C1OUT
C2OUT
C1
C2
VIN+
A
A
RB5/KBI1/T0CKI/C1OUT*
RA1/AN1
RA2/AN2/
VIN-
CIS = 0
CIS = 1
D
D
VIN-
VIN+
RA1/AN1
RA2/AN2/
VREF-/CVREF/
Off (Read as ‘0’)
C2
VIN+
CVREF
VREF-/CVREF/
From VREF Module
A = Analog Input, port reads zeros always
D = Digital Input
CIS (CMCON<3>) is the Comparator Input Switch
* Setting the TRISA<5> bit will disable the comparator outputs by configuring the pins as inputs.
DS39682E-page 226
© 2009 Microchip Technology Inc.