Thursday, February 21, 2008

Getting Started :PIC 16f877A Analog to Digital conversion tutorial

What is Analog to digital conversion ?

My first post in the series of "Mastering PIC microcontroller Programming " is gonna be about ADC(Analog to Digital Converter).
Well what is A2D first of all ?
We all have done analog to digital conversion (A2D) .You dont beleive me ? .Remember the 5th grade science experiment of finding the boiling point of water .We take down the readings of the thermometer every 30 seconds until it reaches a contant .Although the temperature varies continously we only note the reading between specified time interval ie You are sampling the continuous data into a sampled data and reconstructing the continuous curve based on the data we have .So we all have done the basis of A2D in our lives .

PIC Microcontrollers have 10 BIT ADC's .That means the range is from 0-1023 or 0-(2^10 - 1).If we set the reference voltage at 5 volts then 0 - 5 volts can be represented as 0 - 1023 in the digital format .ie 5 v would represent 1023 2.5 v would represent 512(rounded).That is the microcontroller would understand 2.5 v as 50% of 2.5 .
The formula to calculate the digital value is

x= (Vin/Vfullscale )(2^n-1)

following this formula

x=(2.5/5)*1023 =511.5 (512 approx)

Then the next question arises about the a2d resolution .To put it simply what is the minimum voltage that the microcontroller would be sensitive .The resolution of 10 bit microcontroller with 5 v as reference is

5/1023 =4.88 mv .

The microcontroller would measure a minimum change of 4.8 mv below which it will be insensitive .
The general formula for resolution would be

V res = V Fullscale /2^n-1

Vfullscake = What you set as reference
n= No of bits (10 bit in PIC16F877A)

I assume that you might have understood the basics of A2D and move on to the next step .
The next tutorial is gonna be about the A2D Registers in PIC16F877A . NEXT TUTORIAL>>>>>>

1 comment:

Anonymous said...

Hello,

I am regular visitor of this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]roboticsforyou.blogspot.com is filled with quality info. Do you pay attention towards your health?. Let me show you one truth. Recent Scientific Research indicates that nearly 70% of all United States adults are either fat or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these individuals, you're not alone. Its true that we all can't be like Brad Pitt, Angelina Jolie, Megan Fox, and have sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? Quick weight loss can be achived with little effort. If you improve some of your daily diet habbits then, its like piece of cake to quickly lose weight.

About me: I am writer of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health trainer who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for fast weight loss.