Changing OSC type & speed during program execution (for power control)


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default Changing OSC type & speed during program execution (for power control)

    Hello,

    Is it possible to change the OSC speed and type (from Xtal to Internal Oscillator) during the program's execution within the program (=originated by the program, not by an external switch)?

    In other words, can I start my application using a 20MHz Xtal and then, after some operation needing this "high" speed, I can switch over to the internal 4MHz oscillator?
    Roger

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Yes, you can change oscillator types and speeds at runtime.
    Charles Linquist

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    If you're using a device like the 16F917, I think you can change the speed on the fly by writing to the OSCCON register. However, there is a catch. How will you inform PBP about the speed change? The define OSC 8 will set the speeds for most of their functions like pause and I2C timings. I dont know if they read the OSCCON to decide or just use the define. So, I guess you'll have to tread with caution

  4. #4
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    Hello,

    Is it possible to change the OSC speed and type (from Xtal to Internal Oscillator) during the program's execution within the program (=originated by the program, not by an external switch)?

    In other words, can I start my application using a 20MHz Xtal and then, after some operation needing this "high" speed, I can switch over to the internal 4MHz oscillator?
    As the others have said, you can, depending on the pic. To change the internal clock speed (typically they range from 31kHz to 8MHz) with most pic's it is the osccon register. You'll have to read the datasheet on your specific pic to know what it can do, and how to do it. They usually have a section on the Oscillator.

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    Thanks to All.

    I'm going to do some testing...
    Roger

Similar Threads

  1. Replies: 11
    Last Post: - 6th November 2008, 10:27
  2. Replies: 14
    Last Post: - 26th September 2007, 05:41
  3. Please explain about this program
    By wafagenius in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th October 2006, 01:25
  4. Speed Control (help Idea)
    By jetpr in forum General
    Replies: 0
    Last Post: - 1st November 2005, 01:51
  5. Replies: 9
    Last Post: - 30th August 2005, 06:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts