Datasheet

PIC18F2XK20/4XK20
DS40001303H-page 272 2010-2015 Microchip Technology Inc.
21.0 VOLTAGE REFERENCES
There are two independent voltage references
available:
Programmable Comparator Voltage Reference
1.2V Fixed Voltage Reference
21.1 Comparator Voltage Reference
The Comparator Voltage Reference module provides
an internally generated voltage reference for the com-
parators. The following features are available:
Independent from Comparator operation
Two 16-level voltage ranges
Output clamped to VSS
Ratiometric with VDD
1.2 Fixed Reference Voltage (FVR)
The CVRCON register (Register 21-1) controls the
Voltage Reference module shown in Figure 21-1.
21.1.1 INDEPENDENT OPERATION
The comparator voltage reference is independent of
the comparator configuration. Setting the CVREN bit of
the CVRCON register will enable the voltage reference
by allowing current to flow in the CV
REF voltage divider.
When both the CVREN bit is cleared, current flow in the
CVREF voltage divider is disabled minimizing the power
drain of the voltage reference peripheral.
21.1.2 OUTPUT VOLTAGE SELECTION
The CVREF voltage reference has two ranges with 16
voltage levels in each range. Range selection is
controlled by the CVRR bit of the CVRCON register.
The 16 levels are set with the CVR<3:0> bits of the
CVRCON register.
The CVREF output voltage is determined by the following
equations:
EQUATION 21-1: CVREF OUTPUT VOLTAGE
The full range of VSS to VDD cannot be realized due to
the construction of the module. See Figure 21-1.
21.1.3 OUTPUT CLAMPED TO VSS
The CVREF output voltage can be set to Vss with no
power consumption by configuring CVRCON as
follows:
CVREN = 0
•CVRR=1
•CVR<3:0>=0000
This allows the comparator to detect a zero-crossing
while not consuming additional CV
REF module current.
21.1.4 OUTPUT RATIOMETRIC TO VDD
The comparator voltage reference is VDD derived and
therefore, the CV
REF output changes with fluctuations in
V
DD. The tested absolute accuracy of the Comparator
Voltage Reference can be found in Section 26.0
“Electrical Specifications”.
21.1.5 VOLTAGE REFERENCE OUTPUT
The CVREF voltage reference can be output to the
device CV
REF pin by setting the CVROE bit of the
CVRCON register to ‘1’. Selecting the reference volt-
age for output on the CV
REF pin automatically overrides
the digital output buffer and digital input threshold
detector functions of that pin. Reading the CVREF pin
when it has been configured for reference voltage out-
put will always return a0’.
Due to the limited current drive capability, a buffer must
be used on the voltage reference output for external
connections to CV
REF. Figure 21-2 shows an example
buffering technique.
21.1.6 OPERATION DURING SLEEP
When the device wakes up from Sleep through an
interrupt or a Watchdog Timer time-out, the contents of
the CVRCON register are not affected. To minimize
current consumption in Sleep mode, the voltage
reference should be disabled.
21.1.7 EFFECTS OF A RESET
A device Reset affects the following:
Comparator voltage reference is disabled
Fixed Voltage Reference is disabled
•CV
REF is removed from the CVREF pin
The high-voltage range is selected
The CVR<3:0> range select bits are cleared
CVRR 1 (low range):=
CVRR 0 (high range):=
CV
REF = (CVRSRC/24) X CVR<3:0> + VREF-
CVRSRC VDD= or [(VREF+) - (VREF-)]
CVREF = (CVRSRC/32) X (8 + CVR<3:0>) + VREF-
Note: V
REF- is 0 when CVRSS = 0