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 CCS Technical Support

PIC 18F452 @ 40 MHz?

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







PIC 18F452 @ 40 MHz?
PostPosted: Wed Feb 09, 2005 5:26 pm     Reply with quote

Dear UG -

Excuse the dumb question, but I am getting conflicting reports from various web sources, so at the risk of being told "RTFM" I decided to ask the pros out there. I want to run an 18F452 at 40 MHz, but apparently this is done not by an external 40 MHz oscillator but by hooking up a 10 MHz oscillator and enabling the internal PLL of the 18452.

1) If this is indeed a correct statement, how do I invoke the PLL?
From the header file:
Code:

// Constants used in setup_oscillator() are:
#define OSC_TIMER1  1
#define OSC_NORMAL  0

My CCS manual doesn't have an entry for "setup_oscillator!!! Hey, I tried the manual, but maybe the wrong one.....

2) I currently have a 20MHz oscillator on the board. Can I use the PLL to use this oscillator to get an effective 40 MHz clock? If so, what command?

Thanks,
Bill
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 5:41 pm     Reply with quote

I won't tell you to RTFM. Laughing

You enable the x4 PLL in the fuses. The setting, I believe, is H4 (check this). Beware that a user reported that the PIC will not start to use the PLL, after being in-circuit programmed, until the power is cycled.

There is no way to get the thing to run at 40 MHz with a 20 MHz xtal. Also be aware that only the parts rated for 40 MHz will run at 40 MHz (reliably, anyway).
valemike
Guest







PostPosted: Wed Feb 09, 2005 5:44 pm     Reply with quote

I just learned to do this today in an earlier post Smile

#include <18F448.h>
#fuses H4,NOWDT,NOPROTECT,NOLVP
#use delay(clock=32000000)

My crystal is 8MHz.

I didn't have any problems starting up after in-circuit programming from an ICD-2, and going into Debug mode.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 09, 2005 5:47 pm     Reply with quote

I'm going to RTFM you but I'm also going to tell you where in the FM to R Shocked

Seriously, look at the data sheet, specifically Table 22-4 (from data sheet on Microchip's web page, always check the latest). There you see a table with the FOSC and TOSC min and maximum ranges for the various oscillator choices.

From this you see that 40MHz is done 2 different ways, external clock at 40MHz or 10MHz xtal with HS+4PLL. The external clock route means you use a clock oscillator which can drive the CLKIN pin directly. If you don't have a clock oscillator but would rather use a 10MHz xtal, then pick the HS+PLL option.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 5:58 pm     Reply with quote

Valemike,
Just for the record, the PLL startup problem is one I experienced with the 18F252 and 452 programming and then /resetting/releasing the processor to run normally.

I contacted Microchip about this and they were the ones that admitted the problem and said power had to be cycled for the PLL to kick in and run at full speed. I have seen several other folks here post with the same problems on those chips. Don't know anyhting about the '448.

Dave
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Feb 09, 2005 6:15 pm     Reply with quote

dyeatman wrote:
Valemike,
Just for the record, the PLL startup problem is one I experienced with the 18F252 and 452 programming and then /resetting/releasing the processor to run normally.

I contacted Microchip about this and they were the ones that admitted the problem and said power had to be cycled for the PLL to kick in and run at full speed. I have seen several other folks here post with the same problems on those chips. Don't know anyhting about the '448.

Dave


Dave, I see now why i didn't experience that problem. When using the ICD-2 in debug mode, and using the ICD-2 to power the board from the RJ-11 cable, MPLAB actually re-cycles the power. I see what you mean though.

-Mike (valemike)
Guest
Guest







Thanks!
PostPosted: Thu Feb 10, 2005 11:13 am     Reply with quote

Thank you all for the responses
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

PostPosted: Thu Feb 10, 2005 11:31 am     Reply with quote

The PLL is a little fussy about clock levels as well (you guys pointed out that problem) so you may need a resistor with your crystal.
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