DS1820 with 16f688


Results 1 to 14 of 14

Threaded View

  1. #12
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Is there a way to declare a default value using EEPROMData?
    Not directly.

    But if your data can NEVER include the value 255 ($FF), then yes.

    On power up, read the value from EEPROM.
    If it's 255, write the "default" value.
    Then if you ever need to restore the default value, set the location to $FF and reset.

    Unfortunately, some bootloaders have chosen to "erase" EEPROM values to 0 instead of the $FF done by hardware. This can be problematic.
    As long as you know which way your programmer works, it's a definite possibility.

    ADDED: You can also handle it the same way EE_vars does and create a location that indicates which EEPROM locations have been restored. If the value of that location is less than or equal to (<=) the address being tested, or $FF, restore the default value and only increment the counter AFTER a successful and verified WRITE.
    This way 0, $FF and anything less than the address being tested indicates the location needs to be restored.
    Last edited by Darrel Taylor; - 18th May 2009 at 06:32. Reason: ADDED:
    DT

Similar Threads

  1. DS1820 display with 7-seg 4 digits
    By chai98a in forum Code Examples
    Replies: 12
    Last Post: - 10th April 2008, 13:12
  2. PIC lcd ds1820
    By wchpikus in forum mel PIC BASIC
    Replies: 2
    Last Post: - 24th May 2007, 14:46
  3. Help with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th October 2006, 23:12
  4. DS1820 again
    By paxmowa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th January 2006, 14:49
  5. Problem with 16F688 and Hserout
    By DWV in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 19th March 2005, 05:37

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