Microchip Technology DM164134 Scheda Tecnica
© 2006 Microchip Technology Inc.
DS41159E-page 255
PIC18FXX8
22.0
COMPARATOR VOLTAGE
REFERENCE MODULE
REFERENCE MODULE
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 CV
provides a selectable voltage reference. 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
CVRCON register controls the operation of the
reference, as shown in Register 22-1. The block
diagram is shown in Figure 22-1.
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 V
come from either V
DD
and 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.
the CVRSS bit.
22.1
Configuring the Comparator
Voltage Reference
Voltage Reference
The comparator voltage reference can output 16 distinct
voltage levels for each range. The equations used to
calculate the output of the comparator voltage reference
are as follows.
voltage levels for each range. The equations used to
calculate the output of the comparator voltage reference
are as follows.
EQUATION 22-1:
EQUATION 22-2:
The settling time of the Comparator Voltage Reference
must be considered when changing the RA0/AN0/
CV
must be considered when changing the RA0/AN0/
CV
REF
output (see Table 27-4 in Section 27.2 “DC
Characteristics”).
REGISTER 22-1:
CVRCON: COMPARATOR VOLTAGE REFERENCE CONTROL REGISTER
Note:
The comparator voltage reference is only
available on the PIC18F448 and
PIC18F458.
available on the PIC18F448 and
PIC18F458.
If CVRR = 1:
CV
CV
REF
= (CVR<3:0>/24) x CV
RSRC
where:
CVRSS = 1, CV
RSRC
= (V
REF
+) – (V
REF
-)
CVRSS = 0, CV
RSRC
= AV
DD
– AV
SS
If CVRR = 0:
CV
CV
REF
= (CV
RSRC
x 1/4) + (CVR<3:0>/32) x CV
RSRC
where:
CVRSS = 1, CV
RSRC
= (V
REF
+) – (V
REF
-)
CVRSS = 0, CV
RSRC
= AV
DD
– AV
SS
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
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
bit 7
bit 0
bit 7
CVREN: Comparator Voltage Reference Enable bit
1
= CV
REF
circuit powered on
0
= CV
REF
circuit powered down
bit 6
CVROE: Comparator V
REF
Output Enable bit
1
= CV
REF
voltage level is also output on the RA0/AN0/CV
REF
pin
0
= CV
REF
voltage is disconnected from the RA0/AN0/CV
REF
pin
bit 5
CVRR: Comparator V
REF
Range Selection bit
1
= 0.00 CV
RSRC
to 0.625 CV
RSRC
with CV
RSRC
/24 step size
0
= 0.25 CV
RSRC
to 0.719 CV
RSRC
with CV
RSRC
/32 step size
bit 4
CVRSS: Comparator V
REF
Source Selection bit
1
= Comparator reference source, CV
RSRC
= (V
REF
+) – (V
REF
-)
0
= Comparator reference source, CV
RSRC
= V
DD
– V
SS
bit 3-0
CVR<3:0>: Comparator V
REF
Value Selection 0
≤ CVR3:CVR0 ≤ 15 bits
When CVRR = 1:
CV
CV
REF
= (CVR3:CVR0/24)
• (CV
RSRC
)
When CVRR = 0:
CV
CV
REF
= 1/4
• (CV
RSRC
) + (CVR3:CVR0/32)
• (CV
RSRC
)
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