Datasheet

PIC18F1230/1330
2009 Microchip Technology Inc. DS39758D-page 183
18.0 COMPARATOR VOLTAGE
REFERENCE MODULE
The comparator voltage reference is a 16-tap resistor
ladder network that provides a selectable reference
voltage. Its purpose is to provide a reference for the
analog comparators.
A block diagram of the module is shown in Figure 18-1.
The resistor ladder is segmented to provide two ranges
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.
18.1 Configuring the Comparator
Voltage Reference
The voltage reference module is controlled through the
CVRCON register (Register 18-1). The comparator
voltage reference provides two ranges of output
voltage, each with 16 distinct levels. The range to be
used is selected by the CVRR bit (CVRCON<5>). The
primary difference between the ranges is the size of the
steps selected by the CV
REF selection bits
(CVR3:CVR0), with one range offering finer resolution.
The equations used to calculate the output of the
comparator voltage reference are as follows:
If CVRR =
1:
CV
REF = ((CVR3:CVR0)/24) x CVRSRC
If CVRR = 0:
CV
REF = (CVRSRC x 1/4) + (((CVR3:CVR0)/32) x
CV
RSRC)
The comparator reference supply voltage can come
from either AV
DD or AVSS, or the external VREF+ that is
multiplexed with RA4 and AV
SS. The voltage source is
selected by the CVRSS bit (CVRCON<4>).
Additionally, the voltage reference can select the
unscaled V
REF+ input for use by the comparators,
bypassing the CV
REF module. (See Table 18-1 and
Figure 18-1.)
The settling time of the comparator voltage reference
must be considered when changing the CV
REF
output (see Table 23-3 in Section 23.0 “Electrical
Characteristics”).
TABLE 18-1: VOLTAGE REFERENCE
OUTPUT
CVREN CVRSS CVREF Comparator Input
00Disabled No reference
01Disabled From V
REF
(CV
REF bypassed)
10Enabled From CV
REF
11Enabled From CVREF