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

info about setup of the AD clock using PIC18F

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



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

info about setup of the AD clock using PIC18F
PostPosted: Fri Jan 08, 2010 5:53 am     Reply with quote

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







PostPosted: Fri Jan 08, 2010 6:05 am     Reply with quote

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

Best Wishes
ik1wvq



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

PostPosted: Fri Jan 08, 2010 4:14 pm     Reply with quote

many thanks Ttelmah. you are the best...

Mauro
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