English
Language : 

PIC18F258 Datasheet, PDF (253/384 Pages) Microchip Technology – High Performance, 28/40-Pin Enhanced FLASH Microcontrollers with CAN
PIC18FXX8
22.0 COMPARATOR VOLTAGE
REFERENCE MODULE
Note:
The Comparator Voltage Reference is only
available on the PIC18F448 and
PIC18F458.
This module is a 16-tap resistor ladder network that
provides a selectable voltage reference. The resistor
ladder is segmented to provide two ranges of CVREF
values and has a power-down function to conserve
power when the reference is not being used. The
CVRCON register controls the operation of the
reference as shown in Register 22-1. The block
diagram is shown in Figure 22-1.
The comparator and reference supply voltage can
come from either VDD and VSS, or the external VREF+
and VREF-, that are multiplexed with RA3 and RA2. The
comparator reference supply voltage is controlled by
the CVRSS bit.
REGISTER 22-1:
CVRCON REGISTER
R/W-0
CVREN
bit 7
R/W-0
CVROE
R/W-0
CVRR
22.1 Configuring the Comparator
Voltage Reference
The Comparator Voltage Reference can output 16 dis-
tinct voltage levels for each range. The equations used
to calculate the output of the Comparator Voltage
Reference are as follows.
EQUATION 22-1:
If CVRR = 1:
CVREF = (CVR<3:0>/24) x CVRSRC
where:
CVRSS = 1, CVRSRC = (VREF+) – (VREF-)
CVRSS = 0, CVRSRC = VDD – VSS
EQUATION 22-2:
If CVRR = 0:
CVREF = (CVRSRC x 1/4) + (CVR<3:0>/32) x CVRSRC
where:
CVRSS = 1, CVRSRC = (VREF+) – (VREF-)
CVRSS = 0, CVRSRC = VDD – VSS
The settling time of the Comparator Voltage Reference
must be considered when changing the RA0/AN0/CVREF
output (see Table 27-4 in Section 27.2).
R/W-0
CVRSS
R/W-0
CVR3
R/W-0
CVR2
R/W-0
CVR1
R/W-0
CVR0
bit 0
bit 7
bit 6
bit 5
bit 4
bit 3-0
CVREN: Comparator Voltage Reference Enable bit
1 = CVREF circuit powered on
0 = CVREF circuit powered down
CVROE: Comparator VREF Output Enable bit
1 = CVREF voltage level is also output on the RA0/AN0/CVREF pin
0 = CVREF voltage is disconnected from the RA0/AN0/CVREF pin
CVRR: Comparator VREF Range Selection bit
1 = 0.00 CVRSRC to 0.625 CVRSRC, with CVRSRC/24 step size
0 = 0.25 CVRSRC to 0.719 CVRSRC, with CVRSRC/32 step size
CVRSS: Comparator VREF Source Selection bit
1 = Comparator reference source CVRSRC = VDD – VSS
0 = Comparator reference source CVRSRC = (VREF+) – (VREF-)
CVR<3:0>: Comparator VREF Value Selection 0 ≤ CVR3:CVR0 ≤ 15 bits
When CVRR = 1:
CVREF = (CVR3:CVR0/24) • (CVRSRC)
When CVRR = 0:
CVREF = 1/4 • (CVRSRC) + (CVR3:CVR0/32) • (CVRSRC)
Legend:
R = Readable bit
- n = Value at POR
W = Writable bit
’1’ = Bit is set
U = Unimplemented bit, read as ‘0’
’0’ = Bit is cleared x = Bit is unknown
 2002 Microchip Technology Inc.
Preliminary
DS41159B-page 251