View previous topic :: View next topic |
Author |
Message |
gbolson
Joined: 24 Oct 2006 Posts: 7
|
PIC18F24J10 using PLL - compiler problems |
Posted: Tue Oct 24, 2006 11:12 am |
|
|
I have been programming PICs in assembly for about 6 years now, but in the last 4 months have switched over to C using the CCS PCH compiler.
On the project I am presently working on, I decided to go from a 20MHz xtal to a 10MHz xtal and then use the 18F24J10's PLL to run at 40MHz. My code had previously read:
Code: | #use delay(clock=20MHZ) |
But to update it to match my new clocking scheme, I changed it to read:
Code: | #use delay(clock=40MHZ, oscillator=10MHZ) |
But, now when I try to compile this, I get an error on this line like this:
Quote: | *** Error 99 "C:\..." Line 28(5,94): Option invalid No PLL
|
What am I missing?
(I have version 4.013 of the PCH compiler)
Greg |
|
|
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
Posted: Tue Oct 24, 2006 12:25 pm |
|
|
According to the V4 Aug, 2006 manual (page 105), "oscillator=10mhz" is not valid for use in the #use delay() directive. _________________ David |
|
|
gbolson
Joined: 24 Oct 2006 Posts: 7
|
|
Posted: Tue Oct 24, 2006 1:16 pm |
|
|
David,
I did take a look at page 105 - and noticed that it didn't reallly address the use of PLLs generating a higher clock rate than the crystal.
I got the idea for doing it the way I did from the help file - in the Index of the help file, if you pull up "#USE DELAY", in the example area it says...
Quote: | //application is using a 10Mhz oscillator, but using the 4x PLL
//to upscale it to 40Mhz. Compiler will set H4 config bit.
#use delay(clock=40M, oscillator=10M)
|
If this is wrong (which it would seem it might be from page 105 of the manual), do you know the right way to tell the compiler that the crystal frequency is not equal to the operation frequency?
Greg |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|