View previous topic :: View next topic |
Author |
Message |
davefromnj
Joined: 03 May 2007 Posts: 42
|
correct setup_adc() when using 4x PLL??? |
Posted: Thu May 10, 2007 10:01 am |
|
|
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
|
|
Posted: Thu May 10, 2007 10:31 am |
|
|
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
|
|
Posted: Thu May 10, 2007 11:15 am |
|
|
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
|
Hello |
Posted: Thu May 10, 2007 12:48 pm |
|
|
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
|
|
Posted: Thu May 10, 2007 1:00 pm |
|
|
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
|
Hello |
Posted: Thu May 10, 2007 1:45 pm |
|
|
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
|
|
Posted: Thu May 10, 2007 1:50 pm |
|
|
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. |
|
|
|