Power-down at the bad time = WRITE


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    78

    Post Power-down at the bad time = WRITE

    p16F913

    I will like to know what is gonna happen if i power down the microcontroller when the WRITE instructions are in use

    To be more accurate let say i will like to write a word variable (16 bits) to eeprom (14 bits).... so i have to use:

    HIGH_BYTE=VAR/256
    LOW_BYTE=VAR-HI_BYTE

    WRITE X, HI_BYTE
    ...power-down mcu occur HERE
    WRITE Y,LOW_BYTE


    Thank you

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You will have bad data at that EEPROM address.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you have data that absolutely cannot be corrupted, then write the data twice in two different blocks. Write a checksum as the last byte of each block.
    On power up, read the blocks and recalculate the checksums. Use the first one that matches.
    Charles Linquist

  4. #4


    Did you find this post helpful? Yes | No

    Default

    would it be easier to use

    WRITE X,VAR.BYTE1
    WRITE Y,VAR.BYTE0

    (I know, not the question lol)

  5. #5
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default checksum algorithm

    what checksum algorithm did you recomend ?



    ...day by day i have to go deeper and deeper...and just for one countdown timer ... i love that

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    For something simple, I generally start with something like $AA or $55 and add every byte to that. Fast and (relatively) foolproof.
    Charles Linquist

Similar Threads

  1. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  2. LCD freeze
    By harryweb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th October 2009, 08:01
  3. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 14:23
  4. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34
  5. HPWM and 16F628A
    By Michael in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th February 2006, 14:27

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