View previous topic :: View next topic |
Author |
Message |
rrb011270
Joined: 07 Sep 2003 Posts: 51
|
40MHz clock from 10MHz using built-in PLL |
Posted: Wed Dec 31, 2003 7:33 pm |
|
|
Mabuhay!
Happy New Year from the Philippines!!!
I read the data sheet of PIC18F452 and it says that you can use 10MHz crystal that will generate a 40MHz clock using the x4 PLL multiplier built-in with the PIC18F452.
Just wondering if anybody in the community have done this? what advantage do I get if I am to implement this in my project?
I'll appreciate if anyone who can provide me a code snippet in using this features and/or share any info of how can I use this x4 PLL multiplier for a 40MHz clock?
Thnk you |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Dec 31, 2003 7:38 pm |
|
|
There isn't really a code snippet. You just set the config bit. In this case, use the H4 instead of HS in the fuse statement. The advantage, well it runs at 40MHz instead of 10MHz. What does that mean? It runs 4x faster. |
|
|
rrb011270
Joined: 07 Sep 2003 Posts: 51
|
|
Posted: Wed Dec 31, 2003 7:47 pm |
|
|
Mark wrote: | There isn't really a code snippet. You just set the config bit. In this case, use the H4 instead of HS in the fuse statement. The advantage, well it runs at 40MHz instead of 10MHz. What does that mean? It runs 4x faster. |
with this 40MHz thing, I can't use any other value of the crystal except the 10MHz crystal?
Is it possible to use a crystal value below 10MHz and use the x4 PLL multiplier for as long it does not exceed the maximum 40MHz clock?
Thank you |
|
|
rrb011270
Joined: 07 Sep 2003 Posts: 51
|
|
Posted: Wed Dec 31, 2003 7:58 pm |
|
|
Mabuhay!
By all means the code will be similar as listed below:
Code: |
#include <18F452.h> // Target PIC Microcontroller IC
#device *=16 // use a 16-bit pointer
#device ICD=TRUE
#fuses H4,NOPROTECT,NOWDT // PIC MCU Configuration
#use delay(clock=40000000) // 40MHz Crystal clock speed
|
Thank you |
|
|
MGP
Joined: 11 Sep 2003 Posts: 57
|
|
Posted: Wed Dec 31, 2003 8:16 pm |
|
|
rrb011270 wrote: |
with this 40MHz thing, I can't use any other value of the crystal except the 10MHz crystal?
Is it possible to use a crystal value below 10MHz and use the x4 PLL multiplier for as long it does not exceed the maximum 40MHz clock?
Thank you |
Yes, it's possible to use a lower frrequency crystal and 4x PLL mode. For instance you could use a 4MHz crystal and run the PIC at 16MHz.
Also be aware that some 18F devices won't run at 40MHz and are limited to 25MHz, be sure to check the errata for your particular device. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
PLL |
Posted: Thu Jan 01, 2004 2:50 pm |
|
|
I've used it a lot... The commnets about resistors demonstrate a ppoor choice of crystal.
Read the data sheet, order the correct crystal type (series) and it works 100% every time... no need to kluge resistors. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 01, 2004 3:38 pm |
|
|
Quote: | Read the data sheet, order the correct crystal type (series) |
In section 2.2 of the 18Fxx2 data sheet, it says this:
PIC18FXX2 oscillator design requires the use of a parallel cut crystal.
and also:
Note: Use of a series cut crystal may give a frequency
out of the crystal manufacturers specifications. |
|
|
Ttelmah Guest
|
Re: PLL |
Posted: Thu Jan 01, 2004 3:57 pm |
|
|
Anonymous wrote: |
I've used it a lot... The commnets about resistors demonstrate a ppoor choice of crystal.
Read the data sheet, order the correct crystal type (series) and it works 100% every time... no need to kluge resistors. |
I disagree, (but also disagree with myself!... :-).
The current 18F452's, now run fine with the original crystals I was using. I first played with the PLL, on some very early chip examples (including four 'pre-release' examples), and the earlier chips gave problems on the same crystals. At the time, MicroChip stated that series resistors would improve the problem (they did), and I have allways left the board space present on latter boards, since it is much easier to wire a link if the resistor is not necessary, than to fiddle around adding resistors to a board not laid out for them.
Two 'demo' boards from MicroChip, supplied by them as part of a drive circuit for the radio driver on a RFPic system (and using the PLL ability), also had the resistors present.
Best Wishes |
|
|
|