PIC12F635/PIC16F636/639
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.
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
Note:
Comparator interrupts should be disabled
during a Comparator mode change to
prevent unintended interrupts.
• Digital function (D): comparator digital output,
overrides port function
• Normal port function (I/O): independent of
comparator
FIGURE 7-6:
COMPARATOR I/O OPERATING MODES (PIC12F635)
Comparator Reset (POR Default Value – low power)
Comparator w/o Output and with Internal Reference
CM<2:0> = 000
CM<2:0> = 100
A
CIN-
CIN+
A
A
CIN-
(1)
COUT
Off
I/O
CIN+
I/O
COUT (pin)
I/O
COUT (pin)
From CVREF Module
Comparator with Output
Multiplexed Input with Internal Reference and Output
CM<2:0> = 001
CM<2:0> = 101
A
CIN-
A
CIN-
CIS = 0
A
COUT
CIS = 1
CIN+
A
COUT
CIN+
D
COUT (pin)
D
COUT (pin)
From CVREF Module
Comparator without Output
Multiplexed Input with Internal Reference
CM<2:0> = 010
CM<2:0> = 110
A
A
CIN-
CIN-
CIS = 0
A
COUT
CIS = 1
COUT
A
CIN+
CIN+
I/O
I/O
COUT (pin)
COUT (pin)
From CVREF Module
Comparator with Output and Internal Reference
Comparator Off (Lowest power)
CM<2:0> = 011
CM<2:0> = 111
A
CIN-
I/O
I/O
CIN-
COUT
I/O
(1)
CIN+
Off
CIN+
D
COUT (pin)
I/O
COUT (pin)
From CVREF Module
Legend: A = Analog Input, ports always reads ‘0’
CIS = Comparator Input Switch (CMCON0<3>)
D = Comparator Digital Output
I/O = Normal port I/O
Note 1: Reads as ‘0’, unless CINV = 1.
DS41232D-page 74
© 2007 Microchip Technology Inc.