PIC18FXX20
mode is changed, the comparator output level may not
be valid for the specified mode change delay shown in
Electrical Specifications (Section 26.0).
20.1 Comparator Configuration
There are eight modes of operation for the compara-
tors. The CMCON register is used to select these
modes. Figure 20-1 shows the eight possible modes.
The TRISF register controls the data direction of the
comparator pins for each mode. If the Comparator
Note: Comparator interrupts should be disabled
during
a
Comparator mode change.
Otherwise, a false interrupt may occur.
FIGURE 20-1:
COMPARATOR I/O OPERATING MODES
Comparators Reset (POR Default Value)
Comparators Off
CM2:CM0 = 000
CM2:CM0 = 111
A
D
VIN-
VIN-
RF6/AN11
RF5/AN10
RF6/AN11
Off (Read as '0')
Off (Read as '0')
Off (Read as '0')
Off (Read as '0')
C1
C2
C1
C2
VIN+
VIN+
A
D
RF5/AN10
A
A
D
VIN-
VIN-
RF4/AN9
RF3/AN8
RF4/AN9
VIN+
VIN+
D
RF3/AN8
Two Independent Comparators with Outputs
Two Independent Comparators
CM2:CM0 = 011
CM2:CM0 = 010
A
VIN-
A
VIN-
RF6/AN11
RF5/AN10
RF6/AN11
RF5/AN10
C1OUT
C1
VIN+
A
C1OUT
C2OUT
C1
C2
VIN+
A
RF2/AN7/C1OUT
A
A
VIN-
A
VIN-
RF4/AN9
RF3/AN8
RF4/AN9
VIN+
C2OUT
C2
VIN+
A
RF3/AN8
RF1/AN6/C2OUT
Two Common Reference Comparators
Two Common Reference Comparators with Outputs
CM2:CM0 = 100
CM2:CM0 = 101
A
A
VIN-
VIN-
RF6/AN11
RF5/AN10
RF6/AN11
RF5/AN10
C1OUT
C2OUT
C1OUT
C1
C2
C1
VIN+
VIN+
A
A
RF2/AN7/C1OUT
A
D
VIN-
RF4/AN9
RF3/AN8
A
VIN-
VIN+
RF4/AN9
C2OUT
C2
VIN+
D
RF3/AN8
RF1/AN6/C2OUT
Four Inputs Multiplexed to Two Comparators
One Independent Comparator with Output
CM2:CM0 = 110
CM2:CM0 = 001
A
A
VIN-
RF6/AN11
RF6/AN11
RF5/AN10
CIS = 0
CIS = 1
VIN-
A
C1OUT
C1
VIN+
A
RF5/AN10
C1OUT
C2OUT
C1
C2
VIN+
RF2/AN7/C1OUT
A
A
RF4/AN9
RF3/AN8
VIN-
CIS = 0
CIS = 1
VIN+
D
VIN-
RF4/AN9
Off (Read as '0')
C2
VIN+
D
RF3/AN8
CVREF
From VREF Module
A = Analog Input, port reads zeros always
DS39609A-page 224
D = Digital Input
CIS (CMCON<3>) is the Comparator Input Switch
Advance Information
2003 Microchip Technology Inc.