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

Runtime switching from INTRC to EC

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







Runtime switching from INTRC to EC
PostPosted: Fri Jan 09, 2009 11:04 pm     Reply with quote

Anyone has any idea how to perform clock switching from INTRC to EC during runtime? TIA
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 09, 2009 11:42 pm     Reply with quote

Always post your PIC.
tomthkho
Guest







PostPosted: Wed Jan 21, 2009 5:12 pm     Reply with quote

PIC18F4550

the current situation is we need to run two clocks, 1. internal at 1MHZ and 2. External at 40Mhz is there a method to switch between the two during runtime?
Ttelmah
Guest







PostPosted: Thu Jan 22, 2009 3:46 am     Reply with quote

You can change oscillators, but not the fuses.
On the 4550, you can switch from the external oscillator to the RC oscillator, using the setup_oscillator instruction. Look at section 3 of the data sheet 'power managed modes', and the constands for setup_oscillator, in the include file. For you:

setup_oscillator(INT_RC|OSC_1MHZ);
#use delay(CLOCK=1000000)

and

setup_oscillator(OSC_NORMAL);
#use delayCLOCK=40M)

with the fuses set to select the 'normal' external hardware oscillator, should give the required speeds.

_However_ some very real caveats exist. Are you using USB?. If so, and this is enumerated, there _will_ be problems if you change the porcessor clock. Also, what is your supply?. Changing _back_ to the high speed is unreliable, unless the supply meets the spec for the high speed, _before_ you implement the switch 'up'.

Best Wishes
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