View previous topic :: View next topic |
Author |
Message |
esm Guest
|
clock switching |
Posted: Mon Aug 20, 2007 1:08 pm |
|
|
Is it possibel to switch the system clock from 20Mhz external crystal to the 31 khz internal RC oscillator while the processor is running. I am using a PIC18F4680
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
|
Posted: Mon Aug 20, 2007 1:26 pm |
|
|
I read that. But, I still don't understand how to make the switch. I am starting the processor with an extarnal 20 Mhz xtal. Can I still switch to the internal oscillator?
thanks |
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 20, 2007 2:32 pm |
|
|
Yes.
In fact, you may well already be clock switching. If (for instance), the power-up timer is selected, it is the internal clock that is used to handle this, before the main crystal has started.
You need to look, first at the defines in the .h file, then at section 3.2 in the data sheet, and in particular 3.2.3 (what you want to do).
Now, note that this is triggered, by bit SCS1. Look at the defines. Note that OSC_INTRC sets this bit, and OSC_NORMAL clears it.
Best Wishes |
|
|
|