Microchip Technology MCU PIC PIC18F87K22-I/PTRSL TQFP-80 MCP PIC18F87K22-I/PTRSL Data Sheet
Product codes
PIC18F87K22-I/PTRSL
2009-2011 Microchip Technology Inc.
DS39960D-page 375
PIC18F87K22 FAMILY
25.0
COMPARATOR VOLTAGE
REFERENCE MODULE
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
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
The resistor ladder is segmented to provide a range of
CV
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
The module’s supply reference can be provided from
either device V
DD
/V
SS
or an external voltage reference.
25.1
Configuring the Comparator
Voltage Reference
Voltage Reference
The comparator voltage reference module is controlled
through the CVRCON register (
through the CVRCON register (
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.
output voltage with 32 levels.
The CVR<4:0> selection bits (CVRCON<4:0>) offer a
range of output voltages.
shows the how
the comparator voltage reference is computed.
EQUATION 25-1:
The comparator reference supply voltage can come
from either V
from either V
DD
and V
SS
, or the external V
REF
+ 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
(CVRCON<5>).
The settling time of the comparator voltage reference
must be considered when changing the CV
REF
output (see
C
VREF
= (V
REF
-) + (CVR<4:0>/32) • (V
REF
+ – V
REF
-)
If CVRSS = 1:
C
VREF
= (AV
SS
) + (CVR<4:0>/32) • (AV
DD
– AV
SS
)
If CVRSS = 0:
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
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
= CV
REF
circuit is powered on
0
= CV
REF
circuit is powered down
bit 6
CVROE:
Comparator V
REF
Output Enable bit
1
= CV
REF
voltage level is output on CV
REF
pin
0
= CV
REF
voltage level is disconnected from CV
REF
pin
bit 5
CVRSS:
Comparator V
REF
Source Selection bit
1
= Comparator reference source, CV
RSRC
= V
REF
+ – V
REF
-
0
= Comparator reference source, CV
RSRC
= AV
DD
– AV
SS
bit 4-0
CVR<4:0>:
Comparator V
REF
Value Selection 0
CVR<4:0> 31 bits
When CVRSS = 1:
CV
CV
REF
= (V
REF
-) + (CVR<4:0>/32)
(V
REF
+ – V
REF
-)
When CVRSS = 0:
CV
CV
REF
= (AV
SS
) + (CVR<4:0>/32)
(AV
DD
– AV
SS
)