View previous topic :: View next topic |
Author |
Message |
demonspells
Joined: 06 Jan 2011 Posts: 26
|
ADC Delays |
Posted: Sat Jun 25, 2011 4:40 am |
|
|
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: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Jun 25, 2011 5:25 am |
|
|
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: 19538
|
|
Posted: Sat Jun 25, 2011 2:31 pm |
|
|
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
|
|
Posted: Sat Jun 25, 2011 2:32 pm |
|
|
thank u guys very much
respects _________________ Badr Ghatasheh |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jun 25, 2011 2:52 pm |
|
|
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 |
|
|
|