Datasheet
2010-2012 Microchip Technology Inc. DS39977F-page 381
PIC18F66K80 FAMILY
25.0 COMPARATOR VOLTAGE
REFERENCE MODULE
The comparator voltage reference is a 32-tap resistor
ladder network that provides a selectable reference
voltage. Although its primary purpose is to provide a
reference for the analog comparators, it may also be
used independently of them.
A block diagram of the module is shown in Figure 25-1.
The resistor ladder is segmented to provide a range of
CV
REF values and has a power-down function to
conserve power when the reference is not being used.
The module’s supply reference can be provided from
either device V
DD/VSS or an external voltage reference.
25.1 Configuring the Comparator
Voltage Reference
The comparator voltage reference module is controlled
through the CVRCON register (Register 25-1). The
comparator voltage reference provides a range of
output voltage with 32 levels.
The CVR<4:0> selection bits (CVRCON<4:0>) offer a
range of output voltages. Equation 25-1 shows the how
the comparator voltage reference is computed.
EQUATION 25-1:
The comparator reference supply voltage can come
from either V
DD and VSS, or the external VREF+ and
V
REF- that are multiplexed with RA3 and RA2. The
voltage source is selected by the CVRSS bit
(CVRCON<5>).
The settling time of the comparator voltage reference
must be considered when changing the CV
REF
output (see Table 31-2 in Section 31.0 “Electrical
Characteristics”
).
If CVRSS = 1:
CVREF = VREF- + • (VREF+ – VREF-)
CVR<4:0>
32
()
If CVRSS = 0:
CVREF = AVSS + • (AVDD – AVSS)
CVR<4:0>
32
()
REGISTER 25-1: CVRCON: COMPARATOR VOLTAGE REFERENCE CONTROL REGISTER
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CVREN CVROE CVRSS CVR4 CVR3 CVR2 CVR1 CVR0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7
CVREN: Comparator Voltage Reference Enable bit
1 =CVREF circuit powered on
0 =CVREF circuit powered down
bit 6
CVROE: Comparator VREF Output Enable bit
1 =CVREF voltage level is output on CVREF pin
0 =CVREF voltage level is disconnected from CVREF pin
bit 5
CVRSS: Comparator VREF Source Selection bit
1 = Comparator reference source, CVRSRC = VREF+–VREF-
0 = Comparator reference source, CVRSRC = AVDD –AVSS
bit 4-0 CVR<4:0>: Comparator VREF Value Selection 0 CVR<4:0> 31 bits
When CVRSS =
1:
CV
REF = (VREF-) + (CVR<4:0>/32) (VREF+ – VREF-)
When CVRSS =
0:
CV
REF = (AVSS) + (CVR<4:0>/32) (AVDD – AVSS)