English
Language : 

PIC16F87XA Datasheet, PDF (138/234 Pages) Microchip Technology – 28/40/44-Pin Enhanced Flash Microcontrollers
PIC16F87XA
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
mode is changed, the comparator output level may not
be valid for the specified mode change delay shown in
Section 17.0 “Electrical Characteristics”.
Note:
Comparator interrupts should be disabled
during a Comparator mode change.
Otherwise, a false interrupt may occur.
FIGURE 12-1:
COMPARATOR I/O OPERATING MODES
Comparators Reset
CM2:CM0 = 000
Comparators Off (POR Default Value)
CM2:CM0 = 111
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
Off (Read as ‘0’)
RA0/AN0 D
RA3/AN3 D
VIN-
VIN+ C1
Off (Read as ‘0’)
RA1/AN1 A
RA2/AN2 A
VIN-
VIN+ C2
Off (Read as ‘0’)
RA1/AN1 D
RA2/AN2 D
VIN-
VIN+ C2
Off (Read as ‘0’)
Two Independent Comparators
CM2:CM0 = 010
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
RA1/AN1 A
RA2/AN2 A
VIN-
VIN+ C2
C1OUT
C2OUT
Two Independent Comparators with Outputs
CM2:CM0 = 011
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
C1OUT
RA4/T0CKI/C1OUT
RA1/AN1 A
RA2/AN2 A
VIN-
VIN+ C2
RA5/AN4/SS/C2OUT
C2OUT
Two Common Reference Comparators
CM2:CM0 = 100
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
C1OUT
RA1/AN1 A
RA2/AN2 D
VIN-
VIN+ C2
C2OUT
Two Common Reference Comparators with Outputs
CM2:CM0 = 101
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
C1OUT
RA4/T0CKI/C1OUT
RA1/AN1 A
RA2/AN2 D
VIN-
VIN+ C2
RA5/AN4/SS/C2OUT
C2OUT
One Independent Comparator with Output
CM2:CM0 = 001
RA0/AN0 A
RA3/AN3 A
VIN-
VIN+ C1
C1OUT
Four Inputs Multiplexed to Two Comparators
CM2:CM0 = 110
RA0/AN0 A
RA3/AN3 A
CIS = 0
CIS = 1
VIN-
VIN+ C1
C1OUT
RA4/T0CKI/C1OUT
RA1/AN1 D
RA2/AN2 D
VIN-
VIN+ C2
Off (Read as ‘0’)
RA1/AN1 A
RA2/AN2 A
CIS = 0 VIN-
CIS = 1
VIN+
C2
C2OUT
CVREF From Comparator
VREF Module
A = Analog Input, port reads zeros always. D = Digital Input. CIS (CMCON<3>) is the Comparator Input Switch.
DS39582B-page 136
 2003 Microchip Technology Inc.