Using Fixed Voltage Reference (FVR) for A/D conversion in enhanced mid-range PIC microcontrollers

The reference voltage plays a very important role in any A/D conversion. It determines both the range and the resolution (Volt/Count) of the A/D conversion. Besides, the accuracy of the conversion also depends upon how stable the reference voltage is. Usually in PIC microcontrollers, the reference voltage for A/D conversion can be selected as the supply voltage itself or provided externally through one or more I/O pins. But the new enhanced mid-range family of 8-bit PIC microcontrollers have a built-in module that generates a stable reference voltage internally.
Using Fixed Voltage Reference (FVR) for A D conversion in enhanced mid-range PIC microcontrollersIt is called Fixed Voltage Reference (FVR) where the output is very stable and independent of the supply voltage (VDD). The output of the FVR can be configured to supply a reference voltage for A/D conversion internally. This article describes how to configure the FVR module to derive the reference voltage of 2.048 V for A/D conversion in PIC16F1827 microcontroller. The analog signal for this experiment is taken from the output of a LM34DZ temperature sensor. After the A/D conversion, the PIC16F1827 displays the temperature on a 2Ă—8 character LCD.

Theory

LM34DZ temperature sensor

The LM34 series are precision integrated-circuit temperature sensors from National Semiconductors, whose output voltage is linearly proportional to the Fahrenheit temperature. They do not require any external calibration to provide typical accuracies of ±1?2?F at room temperature and ±1.5?F over a full ?50 to +300?F temperature range. The LM34DZ is available in a TO-92 case and the relationship between the linear output voltage and the temperature is 10 millivolts per °F. That is, at 75°F it’s output reads 75 * 10 mV = 750 mV. For full range of measurement, the output of LM34DZ goes from -0.50V (-50 ?F) to 3.0V (300 ?F). We are not using any negative voltage source in this experiment, and therefore LM34DZ won’t be able to measure temperature below 0 ?F. Similarly, on the upper side, the measurement could go up to 300 ?F or less if the  positive reference voltage for the A/D conversion process is less than 3.0 V. Find more details about LM34 in its

PIC16F1827 is a member of Microchip’s enhanced mid-range 8-bit microcontroller family. It is pin-compatible with the popular 18-pin predecessors such as PIC16F628A and PIC16F88, but is equipped with lot more peripherals and other features. The Fixed Voltage Reference (FVR) module in PIC16F1827 generates a stable voltage reference internally. The FVR output provides three software selectable voltage levels, 1.024V, 2.048V and 4.096V. The output can be configured to supply a reference voltage to the following:

• ADC input channel
• ADC positive reference
• Comparator positive input
• Digital-to-Analog Converter (DAC)
• Capacitive Sensing (CPS) module
Using Fixed Voltage Reference (FVR) for A D conversion in enhanced mid-range PIC microcontrollersThe actual generated reference voltage is 1.024 V, but with the help of programmable gain amplifiers, it can be amplified by 1x (1.024 V), 2x (2.048 V), or 4x (4.096 V), to produce the three possible voltage levels. The FVRCON register (shown below) is used to configure the settings for the fixed voltage reference. The bit values of FVRCON register to generate 2.048 V as the positive voltage reference for A/D conversion are shown in blue color font.

Once the FVRCON register is configured, the choice of reference voltage for A/D conversion is made through ADCON1 control register. By setting ADPREF<1:0> bits to ’1′, the positive reference voltage for A/D conversion is derived from the internal FVR module. Clearing the ADNREF bit connects the A/D negative reference voltage pin to the ground (VSS).

Once the reference voltage is selected, the rest of the A/D conversion process is similar to any other PIC microcontroller.

 

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter