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

ADC Delays

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



Joined: 06 Jan 2011
Posts: 26

View user's profile Send private message Yahoo Messenger MSN Messenger

ADC Delays
PostPosted: Sat Jun 25, 2011 4:40 am     Reply with quote

on PIC16F877a , 4MHz
how much delay (minimum) should I use after each of those functions:

Code:

set_adc_channel(0);

v0=read_adc();


adc works on internal clock
I need to be switching between channels as fast as possible
_________________
Badr Ghatasheh
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jun 25, 2011 5:25 am     Reply with quote

I'd suggest 20us between the channel selection and the actual reading. No delay is necessary after reading the ADC.
The datasheet ADC section is full of the real numbers though. Also nothing proves the point better than a real world test. Setup a PIC with say 0,4.99.2.55,0,3.75 precision references on consecutive ADC pins and cut a test program to 'read and display'. After say 10 loops, reduce the delay between channel selection and reading. Sooner or later you'll see what the minimum delay time will be.
Be aware that the 'front end' electronics (stuff before the ADC) will have a bearing on the situation, as well as basic clock speed (4 MHz in your case). Again, that's covered in the datasheets.
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Sat Jun 25, 2011 2:31 pm     Reply with quote

No delay is needed after a reading, _but_ a delay is needed before the next reading.
Basically, the internal circuitry is a capacitor, from which the reading is taken. When you perform an ADC conversion, the capacitor is disconnected for the conversion (this gives the sample and hold effect), so there has to be an acquire time to recharge the capacitor _between_ conversions.

Best Wishes
demonspells



Joined: 06 Jan 2011
Posts: 26

View user's profile Send private message Yahoo Messenger MSN Messenger

PostPosted: Sat Jun 25, 2011 2:32 pm     Reply with quote

thank u guys very much
respects
_________________
Badr Ghatasheh
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 25, 2011 2:52 pm     Reply with quote

Quote:

Also nothing proves the point better than a real world test.
After say 10 loops, reduce the delay between channel selection and
reading. Sooner or later you'll see what the minimum delay time will be.

That test has been done in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=44201
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