CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

help with the analog digital conversion

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
faiselz
Guest







help with the analog digital conversion
PostPosted: Fri Nov 03, 2006 9:49 pm     Reply with quote

hi; i am using the example progam ex_admm.c

can someone tell me, what is the value of the binary number that will be obtained as a result of the ADC conversion due to , for example a 6V input at the analog pin on the PIC? Is there a formula to relate the analog input to the resultant binary number after the conversion..

I will appreciate your help dearly.. thanks..
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Fri Nov 03, 2006 10:31 pm     Reply with quote

If the A/D converter is set to 8 bit resolution, change "1023" to "255". The following is for 10 bit resolution.

binary reading = (analog voltage/reference voltage) * 1023

Example: PIC's A/D Vref+ (positive reference) is +5V, analog input voltage = 3.0V: binary reading = 613.8 which may appear as either 613 or 614.

Note that there is a limit to the actual Vref+ you can use if you opt for an external reference voltage. For most PICs, if Vdd = 5V, the lowest Vref+ can be is 3.0V. The highest Vref+ can be is something like Vdd + 0.3V. Consult the PIC's data sheet for guidance.

These calculations assume that Vref- is 0V (ground). You can set Vref- to a non-zero value, but then the calculation for binary reading above is not valid.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group