Information

PIC18F1230/1330
DS80352B-page 4 © 2008 Microchip Technology Inc.
The equations used to calculate the output of the
comparator voltage reference are as follows:
The comparator reference supply voltage can come
from either AV
DD or AVSS, or the external VREF+ that is
multiplexed with RA4 and AV
SS. The voltage source is
selected by the CVRSS bit (CVRCON<4>).
Additionally, the voltage reference can select the
unscaled V
REF+ input for use by the comparators,
bypassing the CV
REF module. (See Table 17-1 and
Figure 17-1.)
If CVRR = 1:
CV
REF = ((CVR3:CVR0)/24) x CVRSRC
If CVRR = 0:
CV
REF = (CVRSRC x 1/4) + (((CVR3:CVR0)/32)
x CV
RSRC)
TABLE 17-1: VOLTAGE REFERENCE
OUTPUT
CVREN CVRSS CVREF Comparator Input
00Disabled No reference
01Disabled From V
REF
(CV
REF bypassed)
10Enabled From CV
REF
11Enabled From CVREF
REGISTER 17-1: CVRCON: COMPARATOR VOLTAGE REFERENCE CONTROL REGISTER
R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CVREN
CVRR CVRSS CVR3 CVR2 CVR1 CVR0
bit 7 bit 0
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
bit 7 CVREN: Comparator Voltage Reference Enable bit
1 =CV
REF circuit powered on
0 =CV
REF circuit powered down
bit 6 Unimplemented: Read as ‘0
bit 5 CVRR: Comparator V
REF Range Selection bit
1 = 0 to 0.667 CV
RSRC, with CVRSRC/24 step size (low range)
0 = 0.25 CV
RSRC to 0.75 CVRSRC, with CVRSRC/32 step size (high range)
bit 4 CVRSS: Comparator VREF Source Selection bit
When CVRR = 1:
1 = Comparator reference source, CVRSRC = (VREF+) – (AVSS)
0 = Comparator reference source, CV
RSRC = AVDD – AVSS
When CVRR = 0:
1 =VREF+ input used directly, comparator voltage reference bypassed
0 = No reference is provided
bit 3-0 CVR3:CVR0: Comparator V
REF Value Selection bits (0 (CVR3:CVR0) 15)
When CVRR =
1:
CV
REF = ((CVR3:CVR0)/24) (CVRSRC)
When CVRR =
0:
CV
REF = (CVRSRC/4) + ((CVR3:CVR0)/32) (CVRSRC)