English
Language : 

PIC18F2480_09 Datasheet, PDF (264/490 Pages) Microchip Technology – 28/40/44-Pin Enhanced Flash Microcontrollers with ECAN Technology, 10-Bit A/D and nanoWatt Technology
PIC18F2480/2580/4480/4580
21.1 Comparator Configuration
There are eight modes of operation for the compara-
tors, shown in Figure 21-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
changed, the comparator output level may not be valid
for the specified mode change delay shown in
Section 28.0 “Electrical Characteristics”.
Note:
Comparator interrupts should be disabled
during a Comparator mode change;
otherwise, a false interrupt may occur.
FIGURE 21-1:
COMPARATOR I/O OPERATING MODES
Comparators Reset (POR Default Value)
CM<2:0> = 000
RD1/PSP1/C1IN- A
VIN-
RD0/PSP0/C1IN+ A
VIN+ C1
Off
(Read as ‘0’)
Comparators Off
CM<2:0> = 111
RD1/PSP1/C1IN- D
RD0/PSP0/C1IN+ D
VIN-
VIN+ C1
Off
(Read as ‘0’)
RD3/PSP3/C2IN- A
A
RD2/PSP2/C2IN+
VIN-
VIN+ C2
Off
(Read as ‘0’)
RD3/PSP3/C2IN- D
RD2/PSP2/C2IN+ D
VIN-
VIN+ C2
Off
(Read as ‘0’)
Two Independent Comparators
CM<2:0> = 010
RD1/PSP1/C1IN- A
VIN-
RD0/PSP0/C1IN+ A
VIN+ C1
RD3/PSP3/C2IN- A
A
RD2/PSP2/C2IN+
VIN-
VIN+ C2
C1OUT
C2OUT
Two Independent Comparators with Outputs
CM<2:0> = 011
RD1/PSP1/C1IN- A
VIN-
RD0/PSP0/C1IN+ A
VIN+ C1
C1OUT
RE1/WR/AN6/C1OUT*
RD3/PSP3/C2IN- A
RD2/PSP2/C2IN+ A
VIN-
VIN+ C2
C2OUT
RE2/CS/AN7/C2OUT*
Two Common Reference Comparators
CM<2:0> = 100
RD1/PSP1/C1IN- A
VIN-
RD0/PSP0/C1IN+ A
VIN+ C1
C1OUT
Two Common Reference Comparators with Outputs
CM<2:0> = 101
RD1/PSP1/C1IN- A
RD0/PSP0/C1IN+ A
VIN-
VIN+ C1
C1OUT
RD3/PSP3/C2IN- A
RD2/PSP2/C2IN+ D
VIN-
VIN+ C2
C2OUT
RE1/WR/AN6/C1OUT*
RD3/PSP3/C2IN- A
RD2/PSP2/C2IN+ D
RE2/CS/AN7/C2OUT*
VIN-
VIN+ C2
C2OUT
One Independent Comparator with Output
CM<2:0> = 001
RD1/PSP1/C1IN- A
RD0/PSP0/C1IN+ A
VIN-
VIN+ C1
RE1/WR/AN6/C1OUT*
RD3/PSP3/C2IN- D
RD2/PSP2/C2IN+ D
VIN-
VIN+ C2
C1OUT
Off
(Read as ‘0’)
Four Inputs Multiplexed to Two Comparators
CM<2:0> = 110
RD1/PSP1/ A
C1IN-
RD0/PSP0/ A
C1IN+
CIS = 0
CIS = 1
VIN-
VIN+ C1
RD3/PSP3/ A
C2IN-
RD2/PSP2/ A
C2IN+
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
* Setting the TRISA<5:4> bits will disable the comparator outputs by configuring the pins as inputs.
DS39637D-page 264
© 2009 Microchip Technology Inc.