Voltage Reference - PICmicro Mid-Range MCU Family

M
Section 19. Voltage Reference
HIGHLIGHTS
This section of the manual contains the following major topics:
19.1 Introduction ..................................................................................................................19-2
19.2 Control Register ...........................................................................................................19-3
19.3 Configuring the Voltage Reference ..............................................................................19-4
19.4 Voltage Reference Accuracy/Error ...............................................................................19-5
19.5 Operation During Sleep ...............................................................................................19-5
19.6 Effects of a Reset.........................................................................................................19-5
19.7 Connection Considerations ..........................................................................................19-6
19.8 Initialization ..................................................................................................................19-7
19.9 Design Tips ..................................................................................................................19-8
19.10 Related Application Notes............................................................................................19-9
19.11 Revision History .........................................................................................................19-10
19
Voltage
Reference
 1997 Microchip Technology Inc.
DS31019A page 19-1
PICmicro MID-RANGE MCU FAMILY
19.1
Introduction
The Voltage Reference module is typically used in conjunction with the Comparator module. The
comparator module’s inputs do not require very large drive, and therefore the drive capability of
the Voltage Reference is limited.
The Voltage Reference is a 16-tap resistor ladder network that provides a selectable voltage reference. The resistor ladder is segmented to provide two ranges of VREF values and has a
power-down function to conserve power when the reference is not being used. The VRCON register controls the operation of the reference as shown in Figure 19-1. The block diagram is given
in Figure 19-1. Within each range, the 16 steps are monotonic (i.e. each increasing code will
result in an increasing output).
Figure 19-1:
Voltage Reference Block Diagram
16 Stages
VREN
8R(1)
R(1)
R(1)
R(1)
R(1)
8R(1)
VRR
VR3
VREF
(From VRCON<3:0>)
16-1 Analog MUX
VR0
Note 1: See parameter D312 in the Electrical Specifications section of the device data sheet.
Table 19-1: Typical Voltage Reference with VDD = 5.0V
VREF
VR3:VR0
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
DS31019A-page 19-2
VRR = 1
VRR = 0
0.00 V
0.21 V
0.42 V
0.63 V
0.83 V
1.04 V
1.25 V
1.46 V
1.67 V
1.88 V
2.08 V
2.29 V
2.50 V
2.71 V
2.92 V
3.13 V
1.25 V
1.41 V
1.56 V
1.72 V
1.88 V
2.03 V
2.19 V
2.34 V
2.50 V
2.66 V
2.81 V
2.97 V
3.13 V
3.28 V
3.44 V
3.59 V
 1997 Microchip Technology Inc.
Section 19. Voltage Reference
19.2
Control Register
Register 19-1: VRCON Register
R/W-0
VREN
bit 7
R/W-0
VROE
R/W-0
VRR
U-0
—
R/W-0
VR3
R/W-0
VR2
R/W-0
VR1
R/W-0
VR0
bit 0
bit 7
VREN: VREF Enable
1 = VREF circuit powered on
0 = VREF circuit powered down
bit 6
VROE: VREF Output Enable
1 = VREF is internally connected to Comparator module’s VREF. This voltage level is also
output on the VREF pin
0 = VREF is not connected to the comparator module. This voltage is disconnected from the
VREF pin
bit 5
VRR: VREF Range selection
1 = 0V to 0.75 VDD, with VDD/24 step size
0 = 0.25 VDD to 0.75 VDD, with VDD/32 step size
bit 4
Unimplemented: Read as '0'
bit 3:0
VR3:VR0: VREF value selection 0 ≤ VR3:VR0 ≤ 15
When VRR = 1:
VREF = (VR<3:0>/ 24) • VDD
When VRR = 0:
VREF = 1/4 * VDD + (VR3:VR0/ 32) • VDD
Legend
R = Readable bit
W = Writable bit
U = Unimplemented bit, read as ‘0’
- n = Value at POR reset
19
Voltage
Reference
 1997 Microchip Technology Inc.
DS31019A-page 19-3
PICmicro MID-RANGE MCU FAMILY
19.3
Configuring the Voltage Reference
The Voltage Reference can output 16 distinct voltage levels for each range.
The equations used to calculate the output of the Voltage Reference are as follows:
if VRR = 1: VREF = (VR3:VR0/24) x VDD
if VRR = 0: VREF = (VDD x 1/4) + (VR3:VR0/32) x VDD
The settling time of the Voltage Reference must be considered when changing the VREF output.
Example 19-1 shows an example of how to configure the Voltage Reference for an output voltage
of 1.25V with VDD = 5.0V.
Generally the VREF and VDD of the system will be known and you need to determine the value to
load into VR3:VR0. Equation 19-1 shows how to calculate the VR3:VR0 value. There will be
some error since VR3:VR0 can only be an integer, and the VREF and VDD levels must be chosen
so that the result is not greater then 15.
Equation 19-1:
Calculating VR3:VR0
When VRR = 1
VR3:VR0 =
VREF
VDD
VR3:VR0 =
VREF - VDD/4
VDD
X 24
When VRR = 0
DS31019A-page 19-4
X 32
 1997 Microchip Technology Inc.
Section 19. Voltage Reference
19.4
Voltage Reference Accuracy/Error
The full range of VSS to VDD cannot be realized due to the construction of the module. The transistors on the top and bottom of the resistor ladder network (Figure 19-1) keep VREF from
approaching VSS or VDD. The Voltage Reference is VDD derived and therefore, the VREF output
changes with fluctuations in VDD. The absolute accuracy of the Voltage Reference can be found
in the Device Data Sheets electrical specification parameter D311.
19.5
Operation During Sleep
When the device wakes up from sleep through an interrupt or a Watchdog Timer time-out, the
contents of the VRCON register are not affected. To minimize current consumption in SLEEP
mode, the Voltage Reference should be disabled.
19.6
Effects of a Reset
A device reset disables the Voltage Reference by clearing the VREN bit (VRCON<7>). This reset
also disconnects the reference from the VREF pin by clearing the VROE bit (VRCON<6>) and
selects the high voltage range by clearing the VRR bit (VRCON<5>). The VREF value select bits,
VRCON<3:0>, are also cleared.
19
Voltage
Reference
 1997 Microchip Technology Inc.
DS31019A-page 19-5
PICmicro MID-RANGE MCU FAMILY
19.7
Connection Considerations
The Voltage Reference Module operates independently of the comparator module. The output of
the reference generator may be connected to the VREF pin if the corresponding TRIS bit is set
and the VROE bit (VRCON<6>) is set. Enabling the Voltage Reference output onto the VREF pin
with an input signal present will increase current consumption. Configuring the VREF as a digital
output with VREF enabled will also increase current consumption.
The VREF pin can be used as a simple D/A output with limited drive capability. Due to the limited
drive capability, a buffer must be used in conjunction with the Voltage Reference output for external connections to VREF. Figure 19-2 shows an example buffering technique.
Figure 19-2:
Voltage Reference Output Buffer Example
VREF Module
R(1)
ANx
•
+
–
•
VREF Output
PIC16CXXX
Note 1: R is the Voltage Reference Output Impedance and is dependent upon the
Voltage Reference Configuration VRCON<3:0> and VRCON<5>.
DS31019A-page 19-6
 1997 Microchip Technology Inc.
Section 19. Voltage Reference
19.8
Initialization
Example 19-1 shows the steps to configure the voltage reference module.
Example 19-1:
MOVLW
MOVWF
BSF
MOVLW
MOVWF
MOVLW
MOVWF
BCF
CALL
Voltage Reference Configuration
0x02
CMCON
STATUS,RP0
0x07
TRISA
0xA6
VRCON
STATUS,RP0
DELAY10
;
;
;
;
;
;
;
;
;
4 Inputs Muxed to 2 comparators
go to Bank1
RA3:RA0 are outputs
outputs
enable VREF
low range set VR3:VR0 = 6
go to Bank0
10 µs delay
19
Voltage
Reference
 1997 Microchip Technology Inc.
DS31019A-page 19-7
PICmicro MID-RANGE MCU FAMILY
19.9
Design Tips
Question 1:
My VREF is not what I expect.
Answer 1:
Any variation of the device VDD will translate directly onto the VREF pin. Also ensure that you have
correctly calculated (specified) the VDD divider which generates the VREF.
Question 2:
I am connecting VREF into a low impedance circuit, and the VREF is not at
the expected level.
Answer 2:
The Voltage Reference module is not intended to drive large loads. A buffer must be used
between the PICmicro’s VREF pin and the load.
DS31019A-page 19-8
 1997 Microchip Technology Inc.
Section 19. Voltage Reference
19.10
Related Application Notes
This section lists application notes that are related to this section of the manual. These application notes may not be written specifically for the Mid-Range MCU family (that is they may be written for the Base-Line, or High-End families), but the concepts are pertinent, and could be used
(with modification and possible limitations). The current application notes related to Voltage Reference are:
Title
Resistance and Capacitance Meter using a PIC16C622
Application Note #
AN611
19
Voltage
Reference
 1997 Microchip Technology Inc.
DS31019A-page 19-9
PICmicro MID-RANGE MCU FAMILY
19.11
Revision History
Revision A
This is the initial released revision of the Voltage Reference description.
DS31019A-page 19-10
 1997 Microchip Technology Inc.