Connect with us

Crystal frequency for PIC

Discussion in 'Electronic Basics' started by Jack// ani, Feb 9, 2005.

Scroll to continue with content
  1. Jack// ani

    Jack// ani Guest

    Hi all,

    I'm confused as how to choose a proper frequency crystal for my PIC
    uC like....16f84a,f628,f877 and so on... I have few question and
    confusion, here it goes.....

    1.Which is better to use, A high frequency crystal(say 10Mhz) or low
    frequency(like 4Mhz). Most common one I've seen is 4Mhz, I want are
    the considerations as to decide which frequency should be used.

    2.I have read that you can crack up your PIC up to 20Mhz. Is that
    right? Will this cause overheating and large current drain, similar to
    overclocked cpu?

    Thanks
     
  2. Neil

    Neil Guest

    Tiny tip - I found that the 16F877A I was using had a 4MHz max in xtal mode,
    but would go to 20MHz in RC mode.
    It did say in the data sheet, but I had to read carefully to find it.
    Tried a 10MHz xtal out of curiosity, and it didn't work.
    hth
    Neil
     
  3. It depends on the application. If you need the speed, go with the higher
    frequency. However, see below.
    Exactly the same thing happens. CMOS, which is what the PIC and you
    computer CPU is made out of, requires power only during the logic
    transitions (except leakage). Thus, there is a roughly linear relation
    between power consumption and speed. That's why desktop CPUs are
    requiring better heatsinks and fans as they get faster.

    Here is the best tip, though: you should learn to read the datasheet.
    They are fairly simple, freely available from microchip, and have
    information about this kind of thing, suggested crystal circuits, etc.
    Also, they are a good resource for the assembler. Just go to
    www.microchip.com and look at the technical information section. If
    there are things you don't understand, you can ask them with their
    support, or ask here.

    --
    Regards,
    Robert Monsen

    "Your Highness, I have no need of this hypothesis."
    - Pierre Laplace (1749-1827), to Napoleon,
    on why his works on celestial mechanics make no mention of God.
     
  4. Byron A Jeff

    Byron A Jeff Guest

    <Hi all,
    <
    <I'm confused as how to choose a proper frequency crystal for my PIC
    <uC like....16f84a,f628,f877 and so on... I have few question and
    <confusion, here it goes.....
    <
    <1.Which is better to use, A high frequency crystal(say 10Mhz) or low
    <frequency(like 4Mhz). Most common one I've seen is 4Mhz, I want are
    <the considerations as to decide which frequency should be used.

    Depends on the application. In general you want the fastest speed that will
    allow your application to operate properly, but no more.

    <
    <2.I have read that you can crack up your PIC up to 20Mhz. Is that
    <right? Will this cause overheating and large current drain, similar to
    <overclocked cpu?

    20 Mhz is possible. Higher current drain of course. However these chips are
    rated for 2 Mhz operation. So you're not actually overclocking them.

    Now the one last issue to throw in is that many of current PIC chips have
    what Michrochip calls nanowatt technology. The most interesting item about
    this technology is that each chip has an internal oscillator that goes up to
    8 Mhz. So you don't need a crystal at all up to 8 Mhz.

    In the 18 pin form factor the 16F88 is the 16F family chip that has this.

    I have an overview of the 16F88 here:

    http://www.finitesite.com/d3jsys/16F88.html

    BAJ
     
  5. Hey Byron,

    You have an error on that page. You specify (incorrectly) that CMCON
    and ADCON1 must be initialized to turn off the analog. The 16F88
    actually powers up with these two registers ready for digital i/o.
    CMCON starts with a value of 0x07 and ADCON1 starts with 0x00.

    OTOH, ANSEL must be initialized as (for some ignorant reason) it does
    power up with all the ADC pins set as analog.
     
  6. John Fields

    John Fields Guest

    ---
    The clock speed needs to be no faster than that required to accomplish
    the verious tasks the µC has to do in the time it needs to accomplish
    them. For example, a timer with a granularity of 1µs would require a
    clock 1000 times faster than a timer with a granularity of 1ms
    executing the same sequence of instructions.
     
  7. Jack// ani

    Jack// ani Guest

    Thanks for all replies.
     
  8. Byron A Jeff

    Byron A Jeff Guest

    <
    <
    <> I have an overview of the 16F88 here:
    <>
    <> http://www.finitesite.com/d3jsys/16F88.html
    <
    <Hey Byron,
    <
    <You have an error on that page. You specify (incorrectly) that CMCON
    <and ADCON1 must be initialized to turn off the analog. The 16F88
    <actually powers up with these two registers ready for digital i/o.
    <CMCON starts with a value of 0x07 and ADCON1 starts with 0x00.
    <
    <OTOH, ANSEL must be initialized as (for some ignorant reason) it does
    <power up with all the ADC pins set as analog.

    Thanks for the tip. I edited that page from my 16F628 page and I didn't
    update that section. Unfortunately I can't get to it right now.

    And nothing about analog powerup is ignorant. Microchip posits, and I believe
    correctly so, that you can have a situation where something has an analog
    input could come up with a voltage that could cause signicant current drain
    if the pin is in digital mode. So they have almost always set up analog/digital
    inputs as analog on powerup. It's been like that since the 16C71 days nearly
    15 years ago.

    BAJ
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-