Datasheet

2010 Microchip Technology Inc. DS41302D-page 67
PIC12F609/615/617/12HV609/615
9.0 COMPARATOR MODULE
The comparator can be used to interface analog
circuits to a digital circuit by comparing two analog
voltages and providing a digital indication of their
relative magnitudes. The comparator is a very useful
mixed signal building block because it provides analog
functionality independent of the program execution.
The Analog Comparator module includes the following
features:
Programmable input section
Comparator output is available internally/externally
Programmable output polarity
Interrupt-on-change
Wake-up from Sleep
•PWM shutdown
Timer1 gate (count enable)
Output synchronization to Timer1 clock input
Programmable voltage reference
User-enable Comparator Hysteresis
9.1 Comparator Overview
The comparator is shown in Figure 9-1 along with the
relationship between the analog input levels and the
digital output. When the analog voltage at V
IN+ is less
than the analog voltage at VIN-, the output of the
comparator is a digital low level. When the analog
voltage at VIN+ is greater than the analog voltage at
V
IN-, the output of the comparator is a digital high level.
FIGURE 9-1:SINGLE COMPARATOR
FIGURE 9-2: COMPARATOR SIMPLIFIED BLOCK DIAGRAM
+
VIN+
V
IN-
Output
Output
VIN+
VIN-
Note: The black areas of the output of the
comparator represents the uncertainty
due to input offsets and response time.
CMOE
MUX
CMPOL
0
1
CMON
(1)
CMCH
From Timer1
Clock
Note 1: When CMON = 0, the comparator will produce a ‘0’ output to the XOR Gate.
2: Q1 and Q3 are phases of the four-phase system clock (F
OSC).
3: Q1 is held high during Sleep mode.
4: Output shown for reference only. See I/O port pin diagram for more details.
DQ
EN
DQ
EN
CL
DQ
RD_CMCON0
Q3*RD_CMCON0
Q1
Set CMIF
To
Reset
CMV
IN-
CMV
IN+
GP1/CIN0-
GP4/CIN1-
0
1
CMSYNC
CMPOL
Data Bus
MUX
COUT
(4)
To PWM Auto-Shutdown
To Timer1 Gate
0
1
CMR
MUX
GP0/CIN+
0
1
MUX
CVREF
CMVREN
FixedRef
CMV
REF
SYNCCMOUT