PIC18FXX20
21.0
COMPARATOR VOLTAGE
REFERENCE MODULE
21.1
Configuring the Comparator
Voltage Reference
The Comparator Voltage Reference is a 16-tap resistor
ladder network that provides a selectable voltage refer-
ence. The resistor ladder is segmented to provide two
ranges of CV
REF
values and has a power-down func-
tion to conserve power when the reference is not being
used. The CVRCON register controls the operation of
the reference as shown in Register 21-1. The block
diagram is given in Figure 21-1.
The comparator reference supply voltage can come
from either V
DD
or V
SS
, or the external V
REF
+ and
V
REF
- that are multiplexed with RA3 and RA2. The
comparator reference supply voltage is controlled by
the CVRSS bit.
Note:
In order to select external V
REF
+ and V
REF
-
supply voltages, the Voltage Reference
Configuration bits (VCFG1:VCFG0) of the
ADCON1 register must be set appropriately.
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:
If CVRR =
1:
CV
REF
= (CVR<3:0>/24) x CV
RSRC
If CVRR =
0:
CV
REF
= (CV
DD
x 1/4) + (CVR<3:0>/32) x CV
RSRC
The settling time of the Comparator Voltage Reference
must be considered when changing the CV
REF
output
REGISTER 21-1:
CVRCON REGISTER
R/W-0
CVREN
bit 7
R/W-0
CVROE
R/W-0
CVRR
R/W-0
CVRSS
R/W-0
CVR3
R/W-0
CVR2
R/W-0
CVR1
R/W-0
CVR0
bit 0
bit 7
CVREN:
Comparator Voltage Reference Enable bit
1
= CV
REF
circuit powered on
0
= CV
REF
circuit powered down
CVROE:
Comparator V
REF
Output Enable bit
(1)
1
= CV
REF
voltage level is also output on the RF5/AN10/CV
REF
pin
0
= CV
REF
voltage is disconnected from the RF5/AN10/CV
REF
pin
CVRR:
Comparator V
REF
Range Selection bit
1
= 0.00 CV
RSRC
to 0.75 CV
RSRC
, with CV
RSRC
/24 step size
0
= 0.25 CV
RSRC
to 0.75 CV
RSRC
, with CV
RSRC
/32 step size
CVRSS:
Comparator V
REF
Source Selection bit
(2)
1
= Comparator reference source CV
RSRC
= V
REF
+ – V
REF
-
0
= Comparator reference source CV
RSRC
= V
DD
– V
SS
CVR3:CVR0:
Comparator V
REF
Value Selection bits (0
≤
VR3:VR0
≤
15)
When CVRR =
1:
CV
REF
= (CVR<3:0>/ 24)
•
(CV
RSRC
)
When CVRR =
0:
CV
REF
= 1/4
•
(CV
RSRC
) + (CVR3:CVR0/ 32)
•
(CV
RSRC
)
Note 1:
If enabled for output, RF5 must also be configured as an input by setting TRISF<5>
to ‘1’.
2:
In order to select external V
REF
+ and V
REF
- supply voltages, the Voltage Refer-
ence Configuration bits (VCFG1:VCFG0) of the ADCON1 register must be set
appropriately.
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
bit 6
bit 5
bit 4
bit 3-0
2003 Microchip Technology Inc.
Advance Information
DS39609A-page 229