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

PIC18F4520 Internal Oscillator

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







PIC18F4520 Internal Oscillator
PostPosted: Thu Dec 17, 2009 10:03 am     Reply with quote

Good Day,
I am trying to use the internal oscillator of the PIC18F4520 at 4MHz with PLL on. However I only get it running at 1MHz. Can anyone help me??
Code:

#FUSES INTRC_IO 

setup_oscillator(OSC_4MHZ|OSC_INTRC|OSC_31250|OSC_PLL_ON);

?????
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 17, 2009 2:21 pm     Reply with quote

When you use the Internal oscillator with the PLL, the only possible
oscillator frequencies are 16 MHz or 32 MHz. There's a schematic
in the 18F4520 data sheet, in the Oscillator section. It shows that
only the 4 MHz and 8 MHz outputs from the internal oscillator can
drive the 4x PLL. So, 4x4 = 16 MHz, and 8x4 = 32 MHz.

If you have a modern version of the compiler, you can set it up
very simply. Just specify internal oscillator in the #fuses and
specify 16 or 32 MHz in the #use delay(). The compiler will set
it up to use the PLL, automatically.

Code:
#include <18F4520.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=16000000) 

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

while(1);


If this doesn't work, then post your compiler version.
(Always post it in your initial post, to save time).
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