Saving variable(s) contents before power is removed


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Smile save on power down

    The PIC16F628 has voltage comparators that can cause an interrupt. In the schematic the programmable reference is compared against a division of the input voltage. If input power falls dangerously low then an interrupt is generated.

    I do not see a way of monitoring supply voltage with out using a pin.

    Good luck!
    Attached Images Attached Images  

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Hi Emavil. This is a snippet of code I use with a 16F872 with eeprom. In case of power interruption it will go back to the mode it was in. The line at the top "IF MODE > 2 Then LET MODE = 0" is only valid with a newly programmed PIC. Once a write is performed, it will read a 0 or 1 or 2. Hope this helps.



    address VAR WORD 'address variable
    TRISA = %00110000
    TRISB = %11111101
    TRISC = %00000000
    Read 1,MODE
    IF MODE > 2 Then LET MODE = 0

    START:
    MAIN PROGRAM HERE


    CHANGEMODE:
    LET MODE = (MODE + 1) 'ADVANCE MODE
    IF MODE > 2 Then LET MODE = 0
    Write 1,MODE
    GoTo START

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ronsimpson View Post
    The PIC16F628 has voltage comparators that can cause an interrupt. In the schematic the programmable reference is compared against a division of the input voltage. If input power falls dangerously low then an interrupt is generated.

    I do not see a way of monitoring supply voltage with out using a pin.

    Good luck!
    Hi, Ron

    Good analysis ...

    you can even avoid using a comparator input, as the Schmitt trigger inputs High/Low thresolds of the pic are quite precise ( you can use pin polling instead of interrupts ).
    If no comparator available, you also can use a To 92 case MC 33064 P5 or equivalent which will drive its output pin LOW for voltage < 4.65 v.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. ADC Max Impendance and Power saving
    By Michael Wakileh in forum Schematics
    Replies: 3
    Last Post: - 28th June 2009, 20:29
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 08:12
  3. 12 Servo's together does not seem to work, Power problem
    By macx75 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th December 2006, 20:30
  4. Saving Variables
    By Tear in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th June 2005, 20:48
  5. saving program variables
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 2nd November 2004, 23:25

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