View previous topic :: View next topic |
Author |
Message |
Guest Guest
|
PIC 18F452 @ 40 MHz? |
Posted: Wed Feb 09, 2005 5:26 pm |
|
|
Dear UG -
Excuse the dumb question, but I am getting conflicting reports from various web sources, so at the risk of being told "RTFM" I decided to ask the pros out there. I want to run an 18F452 at 40 MHz, but apparently this is done not by an external 40 MHz oscillator but by hooking up a 10 MHz oscillator and enabling the internal PLL of the 18452.
1) If this is indeed a correct statement, how do I invoke the PLL?
From the header file:
Code: |
// Constants used in setup_oscillator() are:
#define OSC_TIMER1 1
#define OSC_NORMAL 0
|
My CCS manual doesn't have an entry for "setup_oscillator!!! Hey, I tried the manual, but maybe the wrong one.....
2) I currently have a 20MHz oscillator on the board. Can I use the PLL to use this oscillator to get an effective 40 MHz clock? If so, what command?
Thanks,
Bill |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Wed Feb 09, 2005 5:41 pm |
|
|
I won't tell you to RTFM.
You enable the x4 PLL in the fuses. The setting, I believe, is H4 (check this). Beware that a user reported that the PIC will not start to use the PLL, after being in-circuit programmed, until the power is cycled.
There is no way to get the thing to run at 40 MHz with a 20 MHz xtal. Also be aware that only the parts rated for 40 MHz will run at 40 MHz (reliably, anyway). |
|
|
valemike Guest
|
|
Posted: Wed Feb 09, 2005 5:44 pm |
|
|
I just learned to do this today in an earlier post
#include <18F448.h>
#fuses H4,NOWDT,NOPROTECT,NOLVP
#use delay(clock=32000000)
My crystal is 8MHz.
I didn't have any problems starting up after in-circuit programming from an ICD-2, and going into Debug mode. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Wed Feb 09, 2005 5:47 pm |
|
|
I'm going to RTFM you but I'm also going to tell you where in the FM to R
Seriously, look at the data sheet, specifically Table 22-4 (from data sheet on Microchip's web page, always check the latest). There you see a table with the FOSC and TOSC min and maximum ranges for the various oscillator choices.
From this you see that 40MHz is done 2 different ways, external clock at 40MHz or 10MHz xtal with HS+4PLL. The external clock route means you use a clock oscillator which can drive the CLKIN pin directly. If you don't have a clock oscillator but would rather use a 10MHz xtal, then pick the HS+PLL option. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Wed Feb 09, 2005 5:58 pm |
|
|
Valemike,
Just for the record, the PLL startup problem is one I experienced with the 18F252 and 452 programming and then /resetting/releasing the processor to run normally.
I contacted Microchip about this and they were the ones that admitted the problem and said power had to be cycled for the PLL to kick in and run at full speed. I have seen several other folks here post with the same problems on those chips. Don't know anyhting about the '448.
Dave |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Wed Feb 09, 2005 6:15 pm |
|
|
dyeatman wrote: | Valemike,
Just for the record, the PLL startup problem is one I experienced with the 18F252 and 452 programming and then /resetting/releasing the processor to run normally.
I contacted Microchip about this and they were the ones that admitted the problem and said power had to be cycled for the PLL to kick in and run at full speed. I have seen several other folks here post with the same problems on those chips. Don't know anyhting about the '448.
Dave |
Dave, I see now why i didn't experience that problem. When using the ICD-2 in debug mode, and using the ICD-2 to power the board from the RJ-11 cable, MPLAB actually re-cycles the power. I see what you mean though.
-Mike (valemike) |
|
|
Guest Guest
|
Thanks! |
Posted: Thu Feb 10, 2005 11:13 am |
|
|
Thank you all for the responses |
|
|
Will Reeve
Joined: 30 Oct 2003 Posts: 209 Location: Norfolk, England
|
|
Posted: Thu Feb 10, 2005 11:31 am |
|
|
The PLL is a little fussy about clock levels as well (you guys pointed out that problem) so you may need a resistor with your crystal. |
|
|
|