View previous topic :: View next topic |
Author |
Message |
JerryR
Joined: 07 Feb 2008 Posts: 167
|
Int osc with PLL X4 on PIC18F2520 |
Posted: Fri Sep 05, 2014 8:16 am |
|
|
I have not been able to enable the PLL (OSCTUNE bit 6) using a variety of methods on a PIC18F2520. I would like the clock output to be 32MHz. How would one set flags appropriately to accomplish this. My current flag configuration is below without anything to enable the PLL. Please fill in the blank:
Code: |
#include <18F2520.h>
#device ADC=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Internal RC Osc, with CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOLVP
#FUSES NOWRT //Program memory not write protected
#use delay(clock=8000000)
|
It's probably a stupid mistake on my part . Thanks for the group's indulgence. I'm using compiler version 5.021 inside MPLAB 8.90. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri Sep 05, 2014 8:26 am |
|
|
this....
#use delay(clock=8000000)
says use an 8 MHz clock...
you want a 32 MHz clock so....
#use delay(clock=32000000)
would be a good starting point...
although
I always printout the page in the datasheet that has the 'flow' of clock signals, highlight what I want, decide which configuration is best, then let the compiler decide. After that test using the '1Hz LED' program, dump the listing to see what the fuses are and go from there.
hth
jay |
|
|
JerryR
Joined: 07 Feb 2008 Posts: 167
|
|
Posted: Fri Sep 05, 2014 10:02 am |
|
|
You know... it worked! I know I tried that before when it seemed to be the simplest way to configure the osc, but didn't notice somehow that osctune.6 was set. Now it sets the internal osc to 111 (8MHz) and enables the PLL (OSCTUNE.6=1).
Thanks a bunch! |
|
|
|