? about sleep/wake on pin change and WDT


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    This is a good point. And I did think of this. Currently I have 1 15k pulldown to ground from the pin connected to magnetic switch to help determine high/low state.

    However 60uA is not consistent with this.. I'll just have to keep it in the back of my mind, as I have many other things to get to as well, maybe I'll think of something.
    Last edited by kessral; - 16th January 2007 at 00:02.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Try this;
    Code:
    DEFINE OSC 4
        
        ' GPIO.1 & 3 inputs, rest outputs. Use external pull-ups
        ' on GPIO.1 & 3.
        TRISIO=%00001010
        ' Internal pull-ups off, prescaler to wdt, 1:128 prescale,
        ' wakes up approx every 2.3 seconds.
        OPTION_REG=%01001111
    
        Low GPIO.0 ' pre-condition output for high pulsout
    
    Loop: ' 100K external pull-up on GPIO.1, switch grounds GPIO.1
          ' when pressed
        WHILE GPIO.1 = 0    ' if button pressed, do pulsout
           CLEARWDT         ' reset WDT while in loop
           pulsout 0, 4000  ' pulsout GPIO.0
        WEND
        
        ' Note: It will wakeup about every 2.3 seconds on WDT timeout,
        ' or switch press, but doesn't pulsout unless switch is pressed.    
        @ SLEEP             ; else sleep
        ' Don't need goto here since wake up is a device reset.
        END
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jan 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default ultra low power

    just use a inline resistor and a cap to GND on the output of your switch.

    V+ --- [resistor, 10K?]----[reed switch]----[Capacitor from this line to GND]----pic I/O

    The cap will "store" the switch closure event so that when the unit wakes up it can tell the reed switch was closed while it was sleeping.

    The PIC can then, once it wakes up, flip the input bit to a grounded output to "reset" the circuit. Then just before SLEEP it can make the pin back into an input.

    Note that if the circuit board is damp or dirty and you don't reset the circuit on every wake up from sleep, that eventually the cap can charge up.

    The cap can be very small, 0.01uF (10nF) would work just fine. I tried to make
    a proper ascii schematic but this forum has no code mode that I can see.
    Last edited by dolphin42; - 26th January 2007 at 00:35.

Similar Threads

  1. saving RCREG to word
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th September 2008, 14:51
  2. Changing 18F WDT postscaler on-the-fly
    By Bruce in forum Code Examples
    Replies: 4
    Last Post: - 1st August 2006, 22:09

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