Simple way to determine how long PIC is off


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Posts
    604

    Default Simple way to determine how long PIC is off

    Looking for a simple way to determine how long a PIC has been off when it is turned on. The actual time is not critical - say about five seconds. Just need to know whether it has been off for MORE (or LESS) than 5 seconds when it is turned on.

  2. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Maybe

    If you only want to figure out longer or shorter than 5 seconds maybe you can use 2 pins. One I/O pin and one AD pin.

    Connect both the AD pin and the I/O pin to the + side of a capacitor and then parallell to this capacitor also connect a resistor, both the resistor and cap connect to ground.

    When the pic starts up you read the AD value to see how much the capacitor has discharged. Then you turn on the I/O pin to charge the capacitor full and keep the capacitor charged until you power off the PIC. Then the resistor that is parallell to the cap will discharge it.

    By choosing different values on the capacitor and resistor you can get different discharge times. This combined with the AD value will give you a quite good clue how long the PIC has been off.

    If you dont have any AD avaliable then you might be able to just use a normal digital i/o. If the cap has a high voltage (it has been dischared a short time) the input would read as a "1", if it is discharged for a longer time till will read as a "0". This will be a much less accurate way. Read the input, guess the time, and turn on the pin as an output to re-charge the cap.
    Last edited by Jumper; - 25th July 2009 at 15:37.

  3. #3
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Cool

    How bout using a I2C realtime clock/calandar like the PCA8565.
    Keeps track of time ALL the time.
    (that was the first item I came across after a simple google)
    PIC just stores the real time in a register before shutdown;
    Then, when woke up, reads RTC and compares to register.
    Wham, Bam.... times up!
    T

Similar Threads

  1. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  2. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  3. PIC powered by capacitor for 0,5 second
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 25th August 2007, 09:23
  4. VB sending serial data to PIC
    By Tissy in forum Serial
    Replies: 7
    Last Post: - 8th March 2006, 18:31
  5. Need help on pic to pic flow control (simple problem I think)
    By khufumen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 00:34

Members who have read this thread : 1

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