Datasheet

PIC12F635/PIC16F636/639
DS41232D-page 74 © 2007 Microchip Technology Inc.
7.3 Comparator Configuration
There are eight modes of operation for the comparator.
The CM<2:0> bits of the CMCON0 register are used to
select these modes as shown in Figures 7-6 and 7-7.
I/O lines change as a function of the mode and are
designed as follows:
Analog function (A): digital input buffer is disabled
Digital function (D): comparator digital output,
overrides port function
Normal port function (I/O): independent of
comparator
The port pins denoted as “A” will read as a ‘0
regardless of the state of the I/O pin or the I/O control
TRIS bit. Pins used as analog inputs should also have
the corresponding TRIS bit set to ‘1’ to disable the
digital output driver. Pins denoted as “D” should have
the corresponding TRIS bit set to ‘0 to enable the
digital output driver.
FIGURE 7-6: COMPARATOR I/O OPERATING MODES (PIC12F635)
Note: Comparator interrupts should be disabled
during a Comparator mode change to
prevent unintended interrupts.
Comparator Reset (POR Default Value – low power) Comparator w/o Output and with Internal Reference
CM<2:0> = 000 CM<2:0> = 100
Comparator with Output Multiplexed Input with Internal Reference and Output
CM<2:0> = 001 CM<2:0> = 101
Comparator without Output Multiplexed Input with Internal Reference
CM<2:0> = 010 CM<2:0> = 110
Comparator with Output and Internal Reference Comparator Off (Lowest power)
CM<2:0> = 011 CM<2:0> = 111
Legend: A = Analog Input, ports always reads 0 CIS = Comparator Input Switch (CMCON0<3>)
I/O = Normal port I/O D = Comparator Digital Output
Note 1: Reads as ‘0’, unless CINV = 1.
CIN-
CIN+
Off
(1)
A
A
COUT (pin)
I/O
CIN-
CIN+
COUT
A
I/O
COUT (pin)
I/O
From CVREF Module
CIN-
CIN+
COUT
A
A
COUT (pin)
D
CIN-
CIN+
COUT
A
A
COUT (pin)
D
From CVREF Module
CIS = 0
CIS = 1
CIN-
CIN+
COUT
A
A
COUT (pin)
I/O
CIN-
CIN+
COUT
A
A
COUT (pin)
I/O
From CVREF Module
CIS = 0
CIS = 1
CIN-
CIN+
COUT
A
I/O
COUT (pin)
D
From CVREF Module
CIN-
CIN+
Off
(1)
I/O
I/O
COUT (pin)
I/O