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.
It 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
The 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.
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.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. ACCEPTCheck Privacy Policy
Manage consent
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.