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 holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter