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

how to improve the accuracy of AD Acquisition

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



Joined: 23 May 2007
Posts: 22

View user's profile Send private message

how to improve the accuracy of AD Acquisition
PostPosted: Tue Aug 19, 2008 4:05 am     Reply with quote

I use the pic's AD, but the precision seems not very good. I do not know if there are better way to improve it ? Before acquire the value I give much delay(2ms). I'm using the PIC4523 (12bit AD).
The code is
Code:

set_adc_channel(2);

delay_ms(2);

value = read_adc();
Ttelmah
Guest







PostPosted: Tue Aug 19, 2008 5:00 am     Reply with quote

The delay does nothing, once the voltage on the internal capacitor has charged to within a fraction of a bit of the 'real' voltage, extra doesn't help at all.
Lots of things:

What ADC clock are you using?. What frequency?.
What are you using as the Vref source?.
What is the impedance of the source feeding the ADC input?.
How is your PIC grounded?.
How is it's supply generated?.
What else is going 'on' on the board while you are waiting/reading?.

These cover the most likely problem areas (but not all...).

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Aug 19, 2008 6:43 am     Reply with quote

I would also ask what is happening on the other inputs to the A/D. If you leave one input floating, even if it is not ever selected, it can cause noise on the other channels. It is best to ground unused A/D inputs.
_________________
The search for better is endless. Instead simply find very good and get the job done.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Aug 19, 2008 8:31 am     Reply with quote

Ground planes!

Always keeps analog grounds separate from digital grounds. Never have them tied into the same plane. Your grounds will, of course, come from the same source but always have your digital traces separate from your analog traces. They'll always go back to your main power input source but have that as the only place where the two planes connect. Even if they need to be on the same side of the board, keep them separate.

Digital signals, things going high & low & high, can inject a lot of noise into your analog lines.

If you're creating your circuit on something like a solderless bread board (I call it a proto-board) then that's not possible. When using a proto-board I will place external caps on the input to help filter out noise. Then, when I make the board I'll have the ground planes do the rest.

Ronald
stefsun



Joined: 23 May 2007
Posts: 22

View user's profile Send private message

PostPosted: Wed Aug 20, 2008 2:26 am     Reply with quote

I used the internal voltage reference,I use 2 AD,2 AD pin are empty.if I use the external voltage reference,is that better?
Ttelmah
Guest







PostPosted: Wed Aug 20, 2008 2:47 am     Reply with quote

Er.....
There is not an 'internal voltage reference'...
The only choices for the ADC, are to use the supply rail (which will always be noisy), or an external voltage reference.
There is an internal reference for the _comparator_, but _not_ for the ADC.
I'd say this is your problem.

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
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