Section 20. Comparator Voltage Reference - PIC24F FRM

Section 20. Comparator Voltage Reference Module
HIGHLIGHTS
This section of the manual contains the following major topics:
20.1
20.2
20.3
20.4
20.5
20.6
20.7
20.8
20.9
20.10
20.11
20.12
Introduction ................................................................................................................. 20-2
Configuring the Comparator Voltage Reference ......................................................... 20-3
Control Register .......................................................................................................... 20-4
Voltage Reference Accuracy/Error.............................................................................. 20-5
Operation During Sleep............................................................................................... 20-5
Effects of a Reset ........................................................................................................ 20-5
Connection Considerations ......................................................................................... 20-6
Initialization ................................................................................................................. 20-6
Electrical Specifications .............................................................................................. 20-7
Design Tips ................................................................................................................. 20-8
Related Application Notes........................................................................................... 20-9
Revision History ........................................................................................................ 20-10
20
Comparator Voltage
Reference Module
© 2006 Microchip Technology Inc.
Advance Information
DS39709A-page 20-1
PIC24F Family Reference Manual
20.1
INTRODUCTION
The comparator voltage reference is a 16-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 Figure 20-1. The resistor ladder is segmented to provide
two ranges of voltage reference 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
VDD/VSS or an external voltage reference. The CVREF output is available for the comparators and
typically available for pin output. Please see the specific device data sheet for information.
Figure 20-1:
Comparator Voltage Reference Block Diagram
CVRSS = 1
VREF+
VDD
8R
CVRSS = 0
CVR3:CVR0
R
CVREN
R
16-to-1 MUX
R
R
16 Steps
CVREF
R
R
R
CVRR
VREF-
8R
CVRSS = 1
CVRSS = 0
DS39709A-page 20-2
Advance Information
© 2006 Microchip Technology Inc.
Section 20. Comparator Voltage Reference Module
Table 20-1:
Typical Voltage Reference with CVRSRC = 3.3V
Voltage Reference
CVR<3:0>
20.2
CVRR = 0
CVRR = 1
0
0.83V
0.00V
1
0.93V
0.14V
2
1.03V
0.28V
3
1.13V
0.41V
4
1.24V
0.55V
5
1.34V
0.69V
6
1.44V
0.83V
7
1.55V
0.96V
8
1.65V
1.10V
9
1.75V
1.24V
10
1.86V
1.38V
11
1.96V
1.51V
12
2.06V
1.65V
13
2.17V
1.79V
14
2.27V
1.93V
15
2.37V
2.06V
CONFIGURING THE COMPARATOR VOLTAGE REFERENCE
The comparator voltage reference module is controlled through the CVRCON register
(Register 20-1). The comparator voltage reference provides two ranges of output voltage, each
with 16 distinct levels. The range to be used is selected by the CVRR bit (CVRCON<5>). The
primary difference between the ranges is the size of the steps selected by the Comparator
Voltage Reference Value Selection bits, CVR3:CVR0, with one range offering finer resolution.
The equations used to calculate the comparator voltage reference are as follows:
If CVRR = 1:
Voltage Reference = ((CVR3:CVR0)/24) x (CVRSRC)
If CVRR = 0:
Voltage Reference = (CVRSRC/4) + ((CVR3:CVR0)/32) x (CVRSRC)
The Comparator Voltage Reference Source Voltage (CVRSRC) can come from either VDD and
VSS, or the external VREF+ and VREF- pins that are multiplexed with I/O pins. The voltage source
is selected by the CVRSS bit (CVRCON<4>). The voltage reference is output to the CVREF pin
by setting the CVROE (CVRCON<6>) bit; this will override the corresponding TRIS bit setting.
The settling time of the comparator voltage reference must be considered when changing the
CVREF output (see Section 20.9 “Electrical Specifications”).
20
Comparator Voltage
Reference Module
© 2006 Microchip Technology Inc.
Advance Information
DS39709A-page 20-3
PIC24F Family Reference Manual
20.3
CONTROL REGISTER
Register 20-1:
CVRCON: Comparator Voltage Reference Control Register
U-0
U-0
U-0
U-0
U-0
U-0
U-0
U-0
—
—
—
—
—
—
—
—
bit 15
bit 8
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(1)
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 15-8
Unimplemented: Read as ‘0’
bit 7
CVREN: Comparator Voltage Reference Enable bit
1 = Comparator voltage reference circuit powered on
0 = Comparator voltage reference circuit powered down
bit 6
CVROE: Comparator Voltage Reference Output Enable bit(1)
1 = Voltage level is output on CVREF pin
0 = Voltage level is disconnected from CVREF pin
bit 5
CVRR: Comparator Voltage Reference Range Selection bit
1 = 0 to 0.67 CVRSRC, with CVRSRC/24 step size
0 = 0.25 CVRSRC to 0.75 CVRSRC, with CVRSRC/32 step size
bit 4
CVRSS: Comparator Voltage Reference Source Selection bit
1 = Comparator voltage reference source, CVRSRC = (VREF+) – (VREF-)
0 = Comparator voltage reference source, CVRSRC = AVDD – AVSS
bit 3-0
CVR3:CVR0: Comparator Voltage Reference Value Selection 0 ≤ CVR3:CVR0 ≤ 15 bits
When CVRR = 1:
CVREF = (CVR<3:0>/24) • (CVRSRC)
When CVRR = 0:
CVREF = 1/4 • (CVRSRC) + (CVR<3:0>/32) • (CVRSRC)
Note 1: CVROE overrides the TRIS bit setting.
DS39709A-page 20-4
Advance Information
© 2006 Microchip Technology Inc.
Section 20. Comparator Voltage Reference Module
20.4
VOLTAGE REFERENCE ACCURACY/ERROR
The full range of voltage reference cannot be realized due to the construction of the module. The
transistors on the top and bottom of the resistor ladder network (Figure 20-1) keep the voltage
reference from approaching the reference source rails. The voltage reference is derived from the
reference source; therefore, the voltage reference output changes with fluctuations in that
source. The tested absolute accuracy of the voltage reference can be found in Section 20.9
“Electrical Specifications”.
20.5
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.
20.6
EFFECTS OF A RESET
A device Reset disables the voltage reference by clearing bit, CVREN (CVRCON<7>). This Reset
also disconnects the reference from the CVREF pin by clearing bit, CVROE (CVRCON<6>), and
selects the high-voltage range by clearing bit, CVRR (CVRCON<5>). The CVR value select bits
are also cleared.
20
Comparator Voltage
Reference Module
© 2006 Microchip Technology Inc.
Advance Information
DS39709A-page 20-5
PIC24F Family Reference Manual
20.7
CONNECTION CONSIDERATIONS
The voltage reference module operates independently of the comparator module. The output of
the reference generator may be connected to the CVREF pin if the CVROE bit is set. Enabling the
voltage reference output onto the I/O when it is configured as a digital input will increase current
consumption. Configuring the port associated with CVREF as a digital output, with CVRSS
enabled, will also increase current consumption.
The CVREF output pin can be used as a simple D/A output with limited drive capability. Due to the
limited current drive capability, a buffer must be used on the voltage reference output for external
connections to CVREF. Figure 20-2 shows a buffering technique example.
Figure 20-2:
Comparator Voltage Reference Output Buffer Example
PIC24F
CVREF
Module
R(1)
Voltage
Reference
Output
Impedance
CVREF
+
–
Voltage Reference
Output
Note 1: R is dependent upon the comparator voltage reference control bits, CVRR (CVRCON<5>)
and CVR<3:0> (CVRCON<3:0>).
20.8
INITIALIZATION
This initialization sequence configures the comparator module as two independent comparators
with outputs enabled and Comparator 1 output inverted. The comparator voltage reference module is configured for output enabled and set for 0.25 * VDD. Example 20-1 shows a program
sequence to configure the voltage reference and comparator module. The delay used in this
example is based off of an 8 MHz oscillator.
Example 20-1:
DS39709A-page 20-6
Voltage Reference Configuration
CMCON
= 0x0F10;
//Initialize Comparator Module
CVRCON
= 0x00C0;
//Initialize Voltage Reference Module
CMCONbits.C1EVT = 0;
CMCONbits.C2EVT = 0;
//Clear Comparator 1 Event
//Clear Comparator 2 Event
asm volatile("repeat #40");
Nop();
//Delay 10us
Advance Information
© 2006 Microchip Technology Inc.
Section 20. Comparator Voltage Reference Module
20.9
ELECTRICAL SPECIFICATIONS
20.9.1
Table 20-2:
Param
No.
VR310
AC Characteristics
Settling Time Specifications
Symbol
Characteristic
Settling Time(1)
TSET
Min
Typ
Max
Units
—
—
TBD
μs
Comments
Legend: TBD = To Be Determined
Note 1: Settling time measured while CVRR = 1 and CVR3:CVR0 bits transition from ‘0000’ to ‘1111’.
20.9.2
Table 20-3:
DC Characteristics
DC Specifications
Operating Conditions: 2.0V < VDD < 3.6V, -40°C < TA < +85°C (unless otherwise stated)
Param
No.
Symbol
Characteristic
Min
Typ
Max
Units
CVRSRC/24
—
CVRSRC/32
LSb
VRD310 CVRES
Resolution
VRD311 CVRAA
Absolute Accuracy
—
—
TBD
LSb
VRD312 CVRUR
Unit Resistor Value (R)
—
2k
—
Ω
Comments
Legend: TBD = To Be Determined
20
Comparator Voltage
Reference Module
© 2006 Microchip Technology Inc.
Advance Information
DS39709A-page 20-7
PIC24F Family Reference Manual
20.10
DESIGN TIPS
Question 1:
My voltage reference is not what I expect.
Answer: Any variation of the voltage reference source will translate directly onto the CVREF pin.
Also, ensure that you have correctly calculated (specified) the voltage divider which generates
the voltage reference.
Question 2:
I am connecting CVREF into a low-impedance circuit and the voltage
reference is not at the expected level.
Answer: The voltage reference module is not intended to drive large loads. A buffer must be
used between the PICmicro® MCU device’s CVREF pin and the load (see Figure 20-2).
DS39709A-page 20-8
Advance Information
© 2006 Microchip Technology Inc.
Section 20. Comparator Voltage Reference Module
20.11
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 PIC24F device family, but the concepts
are pertinent and could be used with modification and possible limitations. The current
application notes related to the Comparator Voltage Reference module are:
Title
Application Note #
Resistance and Capacitance Meter Using a PIC16C622
AN611
Make a Delta-Sigma Converter Using a Microcontroller’s Analog Comparator Module
AN700
A Comparator Based Slope ADC
AN863
Oscillator Circuits for RTD Temperature Sensors
AN895
Temperature Measurement Circuits for Embedded Applications
AN929
Analog Sensor Conditioning Circuits – An Overview
AN990
Note:
Please visit the Microchip web site (www.microchip.com) for additional application
notes and code examples for the PIC24F family of devices.
20
Comparator Voltage
Reference Module
© 2006 Microchip Technology Inc.
Advance Information
DS39709A-page 20-9
PIC24F Family Reference Manual
20.12
REVISION HISTORY
Revision A (June 2006)
This is the initial released revision of this document.
DS39709A-page 20-10
Advance Information
© 2006 Microchip Technology Inc.