How to avoid corrupting an EEPROM Write


Closed Thread
Results 1 to 5 of 5
  1. #1
    jessey's Avatar
    jessey Guest

    Default How to avoid corrupting an EEPROM Write

    Hello Everyone

    I'm using a 5K potentiometer connected to an AD converter on my 16F877 to generate a number. The reason I used a pot was, so that I wouldn't have to save the value to the eeprom and take a chance that the value of that variable would become corrupted if I had a power failure during a write to the eeprom.

    Now I'd like to learn the proper way of doing this but don't know where to begin.

    I'd like to use pushbuttons instead of the pot to increase and decrease the value of the variable but I'm not sure on how or what I need to accomplish the task of detecting the power failure to be able to safely save the value of that variable before the power is lost.

    I won't have any problems with the code routines for the pushbuttons to increase and decrease the variable and I know how to save the word variable to the onboard eeprom.

    What I need to know is if I need a special chip of some sort to detect the power failure and will the onboard eeprom be adequate for saving the value? Could someone explain my options and suggest what would be the best way of accomplishing this. I'm totally in the dark on this one and would appreciate any feedback.

    Thanks
    Jessey

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


    Did you find this post helpful? Yes | No

    Default

    Take a look at this thread...

    http://www.picbasic.co.uk/forum/showthread.php?t=360

    Obviously you don't need the connection to the Battery. You need a large capacitor to act as a reservoir to keep the PIC alive long enough to complete an EEPROM write operation (10mS per byte). You simply detect that the power has failed (or not) by sampling the raw supply input and decide whether to proceed with the Write.

    Personally I wouldn't bother... we manufacture hundreds of thosands of products annually, most have some kind of setup in EEPROM which can be user changed with Menu routines. I've yet to hear of a single instance where a system's been corrupted due a power outage. I'm not saying it can't happen, but I am saying that it's a seriously rare occurance that unless I was designing a Mission Critical application (aircraft, medical, elevator, chocolate dispenser kind of thing...) then I wouldn't worry about it.

  3. #3
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Talking

    Don't we just love those chocolates ....... *LOL* But seriously Mel, didn't you forget to mention creditcardreaders. It would surely be a disatser if we couldn't pay for our new shiny dominatrix leather boots just because the machine couldn't read our Visa

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I consider Chocolate as Mission Critical…

    You know the Government tells us that we need to eat five portions of vegetables each day to stay healthy…

    Chocolate comes from a bean… beans are pulses… pulses are right in the middle of the vegetable family, so that makes chocolate squarely a vegetable…

    I believe everything our Government says… yup… every word…

    PS… there is (almost) nothing as sensual as eating chocolate wearing just thigh-high dominatrix boots with long spiky heels… you should try it, it'll change your outlook on life forever…

  5. #5
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Talking

    That would definitely change my life forever. Waking up in the ER with two broken ankles and chocolate smeared all over my face .... some people would find that slightly embarrassing, myself included

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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