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

correct setup_adc() when using 4x PLL???

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



Joined: 03 May 2007
Posts: 42

View user's profile Send private message

correct setup_adc() when using 4x PLL???
PostPosted: Thu May 10, 2007 10:01 am     Reply with quote

Hello all,

I'm using an 18F65J10 with a 4MHz ceramic resonator. I would like to use the 4X PLL multiplier so that the PIC executes code at 16MHz internally.

I would also like my A to D's to work properly...


I seem to be having great difficulty in finding the right combination of constants to pass to the setup_adc() function:

setup_adc(ADC_CLOCK_DIV_16|ADC_TAD_MUL_16);

definitely doesn't seem to be working properly:


Can someone help me out with the right constants to pass to setup_adc ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 10, 2007 10:31 am     Reply with quote

Quote:
definitely doesn't seem to be working properly:

Explain this more. What is your input voltage to the A/D pin ?
What output do you expect to see, and what output are you getting ?

Show the A/D code, and the variable declarations, and the printf
statement. Ideally, post a small test program that just does the
A/D operations and displays the result. Also post your compiler version.
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Thu May 10, 2007 11:15 am     Reply with quote

If you are using version 4 CCS compiler earlier than 4.027 or 4.026( I can't remember which ) the PLL enable code that the compiler generated did not work and you had to set it manually.
davefromnj



Joined: 03 May 2007
Posts: 42

View user's profile Send private message

Hello
PostPosted: Thu May 10, 2007 12:48 pm     Reply with quote

Hello,

Thank you very much for that update...

I'm currently using 4.023, so this sounds about right.... I'm having major timing issues when the PLL is enabled, and they only get crazier when I mess with the setup_adc(null,null) constants.

I have the pic reading adc values, and also sending out a duty cycle 0.5second on, 0.5second off pattern, based on timer0 expiring every 1ms.


When I mess with the setup_adc() constants, the output timing gets really screwed up--sometimes it goes too fast, sometimes too slow.
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Thu May 10, 2007 1:00 pm     Reply with quote

You should really get the latest version, there are a lot of bug fixes between 4.023 and 4.034.
davefromnj



Joined: 03 May 2007
Posts: 42

View user's profile Send private message

Hello
PostPosted: Thu May 10, 2007 1:45 pm     Reply with quote

kevcon wrote:
You should really get the latest version, there are a lot of bug fixes between 4.023 and 4.034.



Is there anywhere that I can see a changelog to see if I NEED to upgrade for my current project?
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Thu May 10, 2007 1:50 pm     Reply with quote

http://www.ccsinfo.com/devices.php?page=versioninfo

This list is far from complete, it doesn't show the bugs I have reported and are fixed, the PLL bug for one. And I'm sure there are many more that have been fixed that aren't included.
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