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 question (18F86K22)

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

ADC question (18F86K22)
PostPosted: Mon Nov 14, 2011 12:58 pm     Reply with quote

Hi There,

I am in the process of redoing my adc readings cause we wanna use the interrupt for getting this done. Looking in the datasheet what TAD i need to use, i found this: For device frequencies above 1 MHz, the
device must be in Sleep mode for the
entire conversion or the A/D accuracy may
be out of specification.
In our design, the mcu is clocked with 20MHz now, is this referring to the device as the mcu or the device as the adc? If later, can I set ADC_CLOCK_DIV_32 and i'll be fine or how do i understand this?
Thanks!
Ron
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 14, 2011 1:07 pm     Reply with quote

The "device" refers to the PIC (not the A/D module).
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Mon Nov 14, 2011 2:04 pm     Reply with quote

Hm really? So how would I best go about this then? Also does the controller keep running its timers? I think as it says any enabled interrupts
Quote:
While in sleep, the microcontroller will
continue running peripherals from their respective internal
clocks (if enabled)

This is from EX_ADMM_SLEEP.C.
But how do i enable this? Otherwise I can't afford to send my mcu to sleep... and miss a timer event!
Any hints?
Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 14, 2011 2:23 pm     Reply with quote

Quote:

Looking in the datasheet what TAD i need to use, i found this: For device frequencies above 1 MHz, the device must be in Sleep mode for the
entire conversion or the A/D accuracy may be out of specification.

That quote from the PIC data sheet only applies if you use the internal
RC oscillator for the A/D. You don't have to use it. Use a clock divisor
mode.

Quote:

In our design, the mcu is clocked with 20MHz now, is this referring to the device as the mcu or the device as the adc? If later, can I set ADC_CLOCK_DIV_32 and i'll be fine or how do i understand this?

The PIC data sheet sure doesn't say to use that divisor for 20 MHz.
It says the correct one right here in this table:
Quote:
TABLE 23-1: TAD vs. DEVICE OPERATING FREQUENCIES

http://ww1.microchip.com/downloads/en/DeviceDoc/39960d.pdf

As I recall now from previous threads, you don't much like reading data
sheets. I'm going to bail while I'm ahead.
cerr



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Mon Nov 14, 2011 2:37 pm     Reply with quote

PCM,

Thanks for that and regarding your note
Quote:
As I recall now from previous threads, you don't much like reading data
sheets. I'm going to bail while I'm ahead.

I don't quite agree. I don't mind reading datasheets but I sometimes don't seem to be finding what I'm looking for and always appreciate your or someone else's assistance!

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