|
|
View previous topic :: View next topic |
Author |
Message |
tomthkho Guest
|
Runtime switching from INTRC to EC |
Posted: Fri Jan 09, 2009 11:04 pm |
|
|
Anyone has any idea how to perform clock switching from INTRC to EC during runtime? TIA |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 09, 2009 11:42 pm |
|
|
Always post your PIC. |
|
|
tomthkho Guest
|
|
Posted: Wed Jan 21, 2009 5:12 pm |
|
|
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
|
|
Posted: Thu Jan 22, 2009 3:46 am |
|
|
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 |
|
|
|
|
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
|