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 CCS Technical Support

Reading ADXL330 with a 16F877a
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah
Guest







PostPosted: Tue Mar 03, 2009 3:49 pm     Reply with quote

According to me, it should be 1024, not 1023.....

The point is that normal ADC's, have 1023 'steps', so though the value goes to 1024, the divisions needed to get the volt per division, is normally 1023.
This is like the difference between the number of posts in a fence, and the number of panels. 1024 posts, but only 1023 panels.

A lot of people here post using 1023 for the division, which is correct for 90% of ADC's. However the PIC ADC, actually reaches 1024, before you get to the full voltage, and the transition from 0 to 1, at the bottom of the range is also displaced, occuring one whole step 'up', instead of at the normal half step point. So though the A/D reads to 1024, and would therefore normally be expected to split the Vref into 1023 steps, it is closer approximated by using 1024.

It actually gets even slightly more complex. Because of the offset in the step locations, the best approximation, is to add 1/2 of the step to the final value as well.....

So, the closest approximation to the actual pin voltage, for a given ADC reading, fo the PIC 10bit ADC, is:

Vstep=Vref/1024

Reading(volts) = (ADC_reading*Vstep)+(Vstep/2)

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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