PIC16F87XA
mode is changed, the comparator output level may not
be valid for the specified mode change delay shown in
the Electrical Specifications (Section 17.0).
12.1 Comparator Configuration
There are eight modes of operation for the compara-
tors. The CMCON register is used to select these
modes. Figure 12-1 shows the eight possible modes.
The TRISA 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. Other-
wise, a false interrupt may occur.
FIGURE 12-1:
COMPARATOR I/O OPERATING MODES
Comparators Reset (POR Default Value)
Comparators Off
CM2:CM0 = 000
CM2:CM0 = 111
A
D
VIN-
VIN-
RA0/AN0
RA3/AN3
RA0/AN0
RA3/AN3
Off (Read as ’0’)
Off (Read as ’0’)
Off (Read as ’0’)
Off (Read as ’0’)
C1
C2
C1
C2
VIN+
VIN+
A
D
A
A
D
D
VIN-
VIN-
RA1/AN1
RA2/AN2
RA1/AN1
RA2/AN2
VIN+
VIN+
Two Independent Comparators with Outputs
CM2:CM0 = 011
Two Independent Comparators
CM2:CM0 = 010
A
VIN-
A
VIN-
RA0/AN0
RA3/AN3
RA0/AN0
RA3/AN3
C1OUT
C2OUT
C1
C2
VIN+
A
C1OUT
C2OUT
C1
C2
VIN+
A
RA4/T0CKI/C1OUT
A
A
VIN-
A
A
VIN-
RA1/AN1
RA2/AN2
RA1/AN1
RA2/AN2
VIN+
VIN+
RA5/SS/AN4/C2OUT
Two Common Reference Comparators
Two Common Reference Comparators with Outputs
CM2:CM0 = 100
CM2:CM0 = 101
A
A
VIN-
VIN-
RA0/AN0
RA3/AN3
RA0/AN0
RA3/AN3
C1OUT
C2OUT
C1OUT
C1
C2
C1
C2
VIN+
VIN+
A
A
RA4/T0CKI/C1OUT
A
D
VIN-
RA1/AN1
RA2/AN2
A
VIN-
VIN+
RA1/AN1
C2OUT
VIN+
D
RA2/AN2
RA5/SS/AN4/C2OUT
Four Inputs Multiplexed to Two Comparators
One Independent Comparator with Output
CM2:CM0 = 110
CM2:CM0 = 001
A
A
A
VIN-
RA0/AN0
RA0/AN0
RA3/AN3
CIS = 0
CIS = 1
VIN-
A
C1OUT
C1
VIN+
RA3/AN3
C1OUT
C2OUT
C1
C2
VIN+
RA4/T0CKI/C1OUT
A
A
RA1/AN1
RA2/AN2
VIN-
CIS = 0
CIS = 1
VIN+
D
D
VIN-
RA1/AN1
RA2/AN2
Off (Read as ’0’)
C2
VIN+
CVREF
From Comparator
VREF Module
A = Analog Input, port reads zeros always. D = Digital Input. CIS (CMCON<3>) is the Comparator Input Switch.
DS39582A-page 134
AdvanceInformation
2001 Microchip Technology Inc.