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







Clock switching?
PostPosted: Tue Sep 27, 2005 7:28 am     Reply with quote

Hi

Im intending on using a PIC from the nanoWatt series - probably the pic16f684 or similar. I've been reading through the datasheet - I would like to use clock switching, as detailed on P26/27 of the datasheet. I would like it to idle using the LF clock, and then be able to switch to the HF clock upon demand. How do I go about doing this in CCS?

Any help appreciated, thanks!
Oli
Guest







...anyone?
PostPosted: Mon Oct 03, 2005 2:42 am     Reply with quote

Can anyone shed any light on this? pointers?
Ttelmah
Guest







PostPosted: Mon Oct 03, 2005 4:08 am     Reply with quote

setup_oscillator.

Basically, on parts supporting it, you setup the external oscillator, with the fuses statement, then use:

setup_oscillator(OSC_31KHZ);
#use_delay(CLOCK=31250)

To change to the low speed oscillator (and keep time delays correctly programmed).

setup_oscillator(OSC_NORMAL);

To switch back.
If you use any software time delays, remember that these are hard-coded, based on the last 'use_delay' statement, so if times need to be accurate, you will have to structure the program flow, to ensure that the correct use_delay, was the last one met, before a delay is used.

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Oct 03, 2005 4:00 pm     Reply with quote

Read the header file for the pic16f684 and see if there is reference to clock modes there.
_________________
The search for better is endless. Instead simply find very good and get the job done.
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