CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Debugging at 64MHz

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Will Reeve



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

Debugging at 64MHz
PostPosted: Mon Oct 12, 2009 4:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 12, 2009 12:20 pm     Reply with quote

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.
Quote:

#include <18F46K20.h>
#fuses INTRC_IO, NOWDT
#use delay(clock=64000000, internal)

//======================================
void main(void)
{

while(1);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group