How to set the internal CPU speed?


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    Thanks Dave!
    Now it makes a lot more sense!
    I noticed you did not use "OSCCON=%01110000"?
    Second does anything change if you are using a 20 MHz Resonator?
    Just seems like you should be putting in a multipication factor some place?

    Thanks, Ed

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    I used "OSCCON=%01110000" in the first code, the one for the internal setup. It is not needed when using the external.

    When using a 20MHz external the first config line will look like this
    @ __CONFIG _CONFIG1H, _HS_OSC_1H & _FSCM_OFF_1H & _RC_OSC_1H

    The HSPLL_OSC_1H is the multiplier. All this chip can do is multiply by four.

    Now you will want to try over-clocking. Water cooled PICs
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2011
    Location
    Los Angeles, California
    Posts
    322


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    Thanks Dave!
    Very interesting! So if I understand correctly, a 20 MHz external crystal with your line of code (thank you for this) will give an internal CPU speed of 40 MHz? By the way I like your idea of a "water cooled" PIC!

    Just curious since I have been away from all this for so long, in the past when you programmed your PIC you would have to specify either XT or HS depending upon what frequency resonator you used. It appears this is now "built-in" with a default of XT? (__CONFIG _CONFIG1H, _XT_OSC_1H).

    It is correct to assume with HSPLL the multiplier is always X4?


    Best, Ed

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    When using a 20MHz external the first config line will look like this

    @ __CONFIG _CONFIG1H, _HS_OSC_1H & _FSCM_OFF_1H & _RC_OSC_1H
    And then this
    DEFINE OSC 20

    "HSPLL" would try to make the running speed 80MHz... I have my doubts if it would work. I have heard some folks tell of these running at 64MHz (and they did not use water...) but the data sheet claims 40MHz is the limit....

    It is correct to assume with HSPLL the multiplier is always X4?
    With this chip, yes.

    From the data sheet
    2. XT Crystal/Resonator
    3. HS High-Speed Crystal/Resonator
    Table 2-1 and table 2-2 are also worth looking at. 2-1 is for resonators without built in capacitors and 2-2 is for crystals. If resonators that have built in capacitors are used, even if they are 4MHz use "HS".
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    If resonators that have built in capacitors are used, even if they are 4MHz use "HS".
    Hi Dave,
    I never heard about that one, where did you ferret out that little tidbit ?
    Is it because the resonators exhibit lower impedance, and thus require more power ? I seldom use the low freq resonators, but I will put that away in my memory bank for the future.
    Thanks
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    Well...
    I have always used the 3 pin resonators with built in capacitors and way back when I knew less than I do now.....

    Making the transition from the Stamp, I was using a 20MHz with the 887, wanted to go with a little less power so I popped in a 4MHz and did not even think about changing the config. It worked fine.

    Then stuff like this from the data sheets
    When operating below 3V VDD, or when
    using certain ceramic resonators at any
    voltage
    , it may be necessary to use the
    HS mode or switch to a crystal oscillator.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: How to set the internal CPU speed?

    RTFDS,
    Still never saw that, probably never read beyond what I already knew inside the box. It makes perfect sense, esp. as it pertains to 3v operation. Anyway, thanks for pointing that out.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Members who have read this thread : 0

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