Connect with us

pic 16f628 internal oscillator question(s)

Discussion in 'Electronic Design' started by Spehro Pefhany, Jan 26, 2004.

  1. http://www.microchip.com/download/lit/pline/picmicro/families/16c62x/40300c.pdf

    Page 147 (+/- 3 sigma typical temperature dependence) and page 136
    (guaranteed oscillator frequency when "calibrated" with OSCCAL).

    Best regards,
    Spehro Pefhany
     
  2. You should go the www.microchip.com and download the data sheets and
    application notes for that (series of ) PIC.
    For timing that has to be stable over a wide voltage and temp range use xtal.
    For non critical cases use the internal oscillator.
     
  3. What I need to know now is how accurate and stable the internal oscillator
    check the datasheet!
    Maybe, just maybe, after calibration and on constant temperature and
    Vcc. But why not use a crystal?


    Wouter van Ooijen

    -- ------------------------------------
    http://www.voti.nl
    PICmicro chips, programmers, consulting
     
  4. jtaylor

    jtaylor Guest

    Just got a little programmer kit with pic for $20 CDN. Whoopee.

    Anyway, I don't know much about these chips, have been googling a lot.

    What I need to know now is how accurate and stable the internal oscillator
    is?

    The pic will be part of a complicated clock. One of the complications will
    be running at some percentages of true time, ranging from about 50% to 800%.

    It would be nice if I could use the internal clock, and once each unit is
    built, run a calibration on it and set a value somewhere that that unit
    would use as the 100% value from then on.

    Is this needed - would the internal oscillator be out by more than say 1
    part in 3600 (1 sec/hr)?

    Would the internal oscillator drift very much? Temperature will be pretty
    much constant, if that matters...
     
  5. jtaylor

    jtaylor Guest

  6. Luhan Monat

    Luhan Monat Guest

    The internal oscillator is great for many projects and frees up some
    pins for other uses. In this case,however, I would spring 89 cents for
    a crystal.
     
  7. Roger Gt

    Roger Gt Guest

    X-No-Archive: yes

    Also an ordinary +-0.01 percent crystal is good
    for about +- 8 seconds per day.
     
  8. Active8

    Active8 Guest

  9. Active8

    Active8 Guest

    My freq counter read 1.5MHz on CLK OUT - 6MHz. I'd say "crap".
    It do.
     
  10. Its quite easy to build a little program/circuit to calibrate the internal
    4MHz oscillator for many pic chips, assuming there is an OSCCAL word. I
    wrote a little program that supports two buttons, and puts out a square
    wave. One button tweaks up osccal, and the other tweaks it down. The result
    is stored in eeprom. You read it out aftewards and use that as your OSCCAL
    value.

    One problem with this approach, however, is that the internal oscillator is
    quite temperature dependent, so your clock will drift around if the weather
    changes.

    You can get temperature compensated crystal oscillators; then, you only need
    to use one pin as the oscillator input, and the clock will be far more
    accurate.

    Another possibility is to use the powerline AC as a clock. It drifts some
    small percentage, but is usually very accurate overall. There are tech notes
    on doing this; basically, you connect a pin up using a 4.7Meg resistor, and
    use the pin change interrupt to increment your clock. It'll change 120 times
    a second in the US, or 100 times a second in Europe.

    Regards,
    Bob Monsen
     
  11. Tim Shoppa

    Tim Shoppa Guest

    Definitely much more. See figures 18-7 through 18-9 in the 16F628
    datasheet. You'll be lucky to get it to better than a minute per hour.
    A twenty-five cent 32.768kHz crystal will get you much better than
    the accuracy you're looking for. The 16F628 has provision for two
    oscillators (one high-or-low-speed and potentially internal, the other
    low-speed) exactly for this reason, and several of the Microchip
    app notes illustrate this usage.

    Tim.
     
  12. And for inbetween cases (+/-0.5%), such as for serial communications
    or many real-world timing tasks that don't involve time-of-day,use a
    resonator.

    Best regards,
    Spehro Pefhany
     
  13. jtaylor

    jtaylor Guest

    Previous poster said no OSCAL; oh well..
    I have a few 32768 crystals around, if I can get the code to turn through
    it's loops in less than 1/100th second using them that would work.

    Temp compensation might be worth it if this thing gets made beyond
    prototype/personal use.
    Gotta be battery operated. Oh well...

    Thanks all - especially the fellow who quoted 6 mHz from his chip; that is
    _too_ far out.
     
  14. Then why keep that counter ;-)?
     
  15. Active8

    Active8 Guest

    Probably because it read 1MHz when using an external 4 MHz XTAL
    osc. FYI, clk out is div by 4.
     
  16. Active8

    Active8 Guest

    The OSCAL word is set at the factory, you know. But if your
    programmer doesnt save and rewrite it...
    In fact, there's an app note for using the watchdog timer as a
    temperature sensor.
    There's some cool compensation schemes, too. Let's build an oven,
    though ;)
     
  17. There was a large batch of 16F chips, where this behaviour occured if you
    ran the supply was at one particular end of the allowable range (5v?). If I
    remember correctly, they run perfectly 'on frequency' at a lower supply
    rail. Basically the oscillator had a problem. However this was not
    'universal'.
    I'd suspect you had one of these examples.

    Best Wishes
     
  18. On a sunny day (Tue, 27 Jan 2004 05:46:09 GMT) it happened Active8
    The PIC has a 4 to 1 instruction cycle. The clkout is 1/4 the clock.

    They claim that the PIC12F675 is calibrated to 1% using OSCCAL.

    Regards,
    Bob Monsen
     
  19. I've found that the OSCCAL set at the factory is off by 5 to 10%, contrary
    to expectations. The factory is someplace in indochina, I think, so its
    probably a temperature thing :)
     
  20. It's also Vdd-dependent.


    Best regards,
    Spehro Pefhany
     
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

-