|
|
View previous topic :: View next topic |
Author |
Message |
Oli Guest
|
Clock switching? |
Posted: Tue Sep 27, 2005 7:28 am |
|
|
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? |
Posted: Mon Oct 03, 2005 2:42 am |
|
|
Can anyone shed any light on this? pointers? |
|
|
Ttelmah Guest
|
|
Posted: Mon Oct 03, 2005 4:08 am |
|
|
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
|
|
Posted: Mon Oct 03, 2005 4:00 pm |
|
|
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. |
|
|
|
|
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
|