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

clock switching

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







clock switching
PostPosted: Mon Aug 20, 2007 1:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Aug 20, 2007 1:21 pm     Reply with quote

Look at the setup_oscillator() function in the CCS manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Guest








PostPosted: Mon Aug 20, 2007 1:26 pm     Reply with quote

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







PostPosted: Mon Aug 20, 2007 2:32 pm     Reply with quote

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