English
Language : 

PIC18F6520-I Datasheet, PDF (226/380 Pages) Micrel Semiconductor – 64/80-Pin High-Performance, 256 Kbit to 1 Mbit Enhanced Flash Microcontrollers with A/D
PIC18F6520/8520/6620/8620/6720/8720
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
mode is changed, the comparator output level may not
be valid for the specified mode change delay shown in
the Electrical Specifications (Section 26.0 “Electrical
Characteristics”).
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)
CM2:CM0 = 000
Comparators Off
CM2:CM0 = 111
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
Off (Read as ‘0’)
RF6/AN11 D
RF5/AN10 D
VIN-
VIN+ C1
Off (Read as ‘0’)
RF4/AN9 A
RF3/AN8 A
VIN-
VIN+ C2
Off (Read as ‘0’)
RF4/AN9 D
RF3/AN8 D
VIN-
VIN+ C2
Off (Read as ‘0’)
Two Independent Comparators
CM2:CM0 = 010
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
RF4/AN9 A
RF3/AN8 A
VIN-
VIN+ C2
C1OUT
C2OUT
Two Independent Comparators with Outputs
CM2:CM0 = 011
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
C1OUT
RF2/AN7/C1OUT
RF4/AN9 A
RF3/AN8 A
VIN-
VIN+ C2
RF1/AN6/C2OUT
C2OUT
Two Common Reference Comparators
CM2:CM0 = 100
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
C1OUT
RF4/AN9 A
RF3/AN8 D
VIN-
VIN+ C2
C2OUT
Two Common Reference Comparators with Outputs
CM2:CM0 = 101
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
C1OUT
RF2/AN7/C1OUT
RF4/AN9 A
RF3/AN8 D
VIN-
VIN+ C2
RF1/AN6/C2OUT
C2OUT
One Independent Comparator with Output
CM2:CM0 = 001
RF6/AN11 A
RF5/AN10 A
VIN-
VIN+ C1
C1OUT
RF2/AN7/C1OUT
RF4/AN9 D
RF3/AN8 D
VIN-
VIN+ C2
Off (Read as ‘0’)
Four Inputs Multiplexed to Two Comparators
CM2:CM0 = 110
RF6/AN11 A
RF5/AN10 A
CIS = 0
CIS = 1
VIN-
VIN+ C1
RF4/AN9 A
RF3/AN8 A
CIS = 0
CIS = 1
VIN-
VIN+ C2
C1OUT
C2OUT
CVREF From VREF Module
A = Analog Input, port reads zeros always
D = Digital Input
CIS (CMCON<3>) is the Comparator Input Switch
DS39609B-page 224
 2004 Microchip Technology Inc.