|
|
View previous topic :: View next topic |
Author |
Message |
ik1wvq
Joined: 21 Feb 2004 Posts: 20
|
info about setup of the AD clock using PIC18F |
Posted: Fri Jan 08, 2010 5:53 am |
|
|
Hi,
I need to done AD conversions as fast as possible (18F2620 - 16MHz clock) without using SLEEP.
I normally used:
Code: |
setup_adc(ADC_CLOCK_INTERNAL);
|
but, by carefully reading the datasheet, i found this:
Quote: |
("RC") "For device frequencies above 1 MHz, the device must be in Sleep
for the entire conversion or the A/D accuracy may be out of specification."
|
Then, what setup I need for ADC conversion without SLEEP ??
The table 19-1 say: 16 TOSC for device frequencies < 22.86MHz.
My setup may be:
Code: |
setup_adc(ADC_CLOCK_DIV_16 | ADC_TAD_MUL_0); ???? |
is it correct ??
Thanks in advance
Regards
Mauro |
|
|
Ttelmah Guest
|
|
Posted: Fri Jan 08, 2010 6:05 am |
|
|
Yes.
As a 'comment', the second part, controls whether the ADC waits before starting the reading. _If_ the reading was in a tight loop, just reading the value, and doing little else, there is not time for the internal capacitor to recharge between readings. The second part allows you to set the ADC, to wait for the capacitor to charge, before taking the value. This is section 19.2 of the data sheet. Provided the total loop time for repeated readings, (excluding the actual ADC reading), is more than 2.4uSec, and at least this much time is also present between selecting the ADC channel, and taking a reading, selecting 'MUL_0' as you have, is OK.
People not realising that the internal clock is not really suitable to get good accuracy from the ADC at higher clock frequencies, is one of my 'bug bears', so 'well done', for reading the data sheet.
Best Wishes |
|
|
ik1wvq
Joined: 21 Feb 2004 Posts: 20
|
|
Posted: Fri Jan 08, 2010 4:14 pm |
|
|
many thanks Ttelmah. you are the best...
Mauro |
|
|
|
|
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
|