Connect with us

PIC crystal oscillator

Discussion in 'Electronic Design' started by A. Lemon, Dec 24, 2006.

Scroll to continue with content
  1. A. Lemon

    A. Lemon Guest

    Hi everyone!

    Is it safe to kill a PIC (16F628) crystal oscillator by shorting the OSC1 to
    ground through a diode (1N4148 or BAT...Schottky)?
    I put this PIC in standby mode by pulling low MCLR. All pins goes to input
    state but the oscillator keeps running and I want to kill it too. SLEEP is
    not an option in my case because I'm stuck with a weird design.

    Merry Christmas!
    Al
     
  2. Jim Thompson

    Jim Thompson Guest

    If OSC1 is the INPUT to the inverter, no problem.

    ...Jim Thompson
     
  3. A. Lemon

    A. Lemon Guest

    OSC1 is indeed the inverter input.
    It does kill the oscillation but I was not sure if the PIC would appreciate.

    Thanks!
     
  4. A. Lemon

    A. Lemon Guest

    The MCLR is also pulled to ground at the same time. The it is pulled up to
    +5V at the same time as the diode is reverse biased at the oscillator.
    I may have a point though. I'll have to check if there is any oscillator
    delay and/or start-up timer upon MCLR reset.

    Al
     
  5. It may not be safe for the execution of your program. It
    won't hurt the oscillator, however.

    The problem is that you will be clipping off some fraction
    of the current clock cycle, and the oscillator will muddle
    back into operation when you release the ground, producing
    who knows what clock waveform for a very many cycles. Can
    you use the internal RC oscillator or an external
    oscillator, instead?
     
  6. I think the option is called POR (power on reset delay).
    This option should always be enabled if you use a crystal
    oscillator without an external MCLR release delay, to let
    the oscillator come up to full amplitude.
     
  7. A. Lemon

    A. Lemon Guest

    Unfortunately POR delay works only at power up, not with MCLR reset... if I
    understand the datasheet correctly.
    The diode shut-off circuit seems to work but it is most probably a "durty"
    solution!

    Al
     
  8. You could add an RC delay that holds MCLR a while after the
    oscilltor is released.
     
  9. The PIC16F684 (and probably others) has a two speed clock start-up mode
    which uses the internal oscillator until the external clock has stabilized.
    It also has a fail-safe clock monitor which detects abnormal clock
    operation and allows the processor to run on the internal clock. You can
    also switch from external to internal clock on-the-fly and possibly shut
    down the external clock oscillator in this way. An unused output pin might
    even be able to shut down the PIC's own external clock once it is running
    on the low speed internal clock, and then go to sleep. Good luck.

    Paul
     
  10. A. Lemon

    A. Lemon Guest

    Yep! This is a very good idea.
    My MCLR pin is set through a 22K resistor,
    I could add 1uF cap to delay the reset about 20mS to allow the oscillator to
    stabilize. This should clean up
    the "dirty" solution ;)

    (Even though in another message, Paul E. Schoen says the oscillator can be
    switched off without this precaution).


    Al
     
  11. A. Lemon

    A. Lemon Guest

    Yep! This is a very good idea.
    (I meant: the oscillator can be switched ON without this precaution)
     
  12. Luhan

    Luhan Guest

    Why not just power it down via VCC pin? Then you guarantee to get OST
    (oscillator start up timer) operation when you power it back up?

    Luhan
     
  13. A. Lemon

    A. Lemon Guest

    I want to keep its power up because it remains connected to another circuit
    via a connector. If I power it down,
    its pins behave like diode to ground and loads the other circuit.
    Keeping the PIC in reset mode puts all its pins in input mode or hi-z
    without loading effect. Its an easy way to isolate both circuits and without
    disconnecting them for each other. I know I could let the oscillator running
    but I just try to keep power as low as possible.

    Al
     
  14. I found that the pin compatible PIC16F628A version has the two speed clock
    and nanowatt technology which allows it to sleep at 100 nA current. Sleep
    also disables the clock oscillator. You could tristate all pins before
    sleep mode to essentially disconnect it. It may actually draw less power
    than holding MCLR low as well as the CLK IN pin, as they probably have some
    current draw through internal pullups and other circuitry.

    Paul
     
  15. A. Lemon

    A. Lemon Guest

    That would be the better solution indeed. Unfortunately I don't have the
    source code. That's why I have to rely on this trick for now. The current
    consumption is however acceptable even though not in the nanowatt range.
    It's under 10uA as far as my meter can measure.

    Al
     
  16. James Beck

    James Beck Guest

    The PIC should be a DC to XXMHz part, so a stopped clock is no problem.
    Whether it can come back alive in a known state is another situation
    unless you make sure you don't short cycle the IC by killing the OSC in
    the middle of the wave form.

    Jim
     
  17. jasen

    jasen Guest

    as others have said this heavy-handed approach to the clock could cause
    problems on restart if the last pulse was only partial. unless you can reset
    the micro each time you restart it might be safer to use an external clock.

    Bye.
    Jasen
     
  18. 2007 Amy

    2007 Amy Guest

  19. Why not include the 1 meg resistor?
     
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

-