Joined: 30 Oct 2003 Posts: 209 Location: Norfolk, England
Debugging at 64MHz
Posted: Mon Oct 12, 2009 4:04 am
Hi,
Using a 18F26K20 with the internal OSC at 64MHz. I am a little confused as to the correct use of the fuses and setup_oscillator() function, the help seems to suggest that the setup_oscillator isn't necessary with the correct fuses. The only way I can get the PIC to run at 64MHz is a single fuse of
#FUSES INTRC_IO
and a setup_oscillator(OSC_64MHZ).
However when debugging the speed is reported as "Ready MCU at 1.00MHz".
I have delay (clock=64000000) and a 1second pulse is measured correctly on my 'scope.
I would have thought a INTRC_IO and a H4 would do the same job in fuses but it appears not.
Compier version is 4.099.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Mon Oct 12, 2009 12:20 pm
When you use the internal oscillator in PLL mode, the PLL has to be
enabled in software. This is done with the setup_oscillator() statement.
You can see this by looking at the parameters for setup_oscillator()
in the 18F26K20.h file. The OSC_64MHZ value includes the OSC_PLL_ON
bits in it.
However, there is an alternate way. You can specify "internal" in the
#use delay() statement. Then you don't need to call setup_oscillator().
CCS will put the instructions to setup the oscillator in the start-up code.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum