How to save data on serial EEPROM like a database ?


Closed Thread
Results 1 to 6 of 6
  1. #1

    Question How to save data on serial EEPROM like a database ?

    Anyone have an experience what is the best algorithm to save data or information on serial eeprom like a database for the ease of reading and searching after saving like this table
    ID Time Date #of register
    =================================
    1200312 8:30 12/9/2009 10
    ....
    and so on

    I know how to save data on serial eeprom using PIC microcontroller but how and what is the best way I don't know ?

    so anyone can help me ?

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    Anyone have an experience what is the best algorithm to save data or information on serial eeprom like a database for the ease of reading and searching after saving like this table
    ID Time Date #of register
    =================================
    1200312 8:30 12/9/2009 10
    ....
    and so on

    so anyone can help me ?
    Just save it as raw character data...wouldn't that be the easiest thing to do? No math needed when saving or retrieving. Sure, it's not the most efficient way to save data, but how expensive is eeprom/flash these days?

  3. #3


    Did you find this post helpful? Yes | No

    Default

    but i think that there are an article or paper for the effiecient way of saving data , I don't know where I see it.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by iugmoh View Post
    but i think that there are an article or paper for the effiecient way of saving data , I don't know where I see it.
    Ok,
    ID Time Date #of register
    =================================
    1200312 8:30 12/9/2009 10

    ID - seems to be a 7 digit number. You can either store that as a single LONG, or 2 WORD's, either in hex format, or BCD... Figure 28 bits

    Time - hours/minutes - 24 hours = 5 bits, 60 minutes = 6 bits, 11 bits for time, 11 bits for this

    Date - Month/Day/Year - 12 months = 4 bits, 31 days = 5 bits, Year-call it 64 years total, offset by +2008, 6 bits; 15 bits total

    Register - don't know how many registers, but I'll assume 16 (numbered 0-15), 4 bits there.

    28 bits for ID + 11 bits for time + 15 bits for date + 4 bits for register = 58 bits, 8 bytes total, with 6 leftover for whatever else.

    Then you play with the bits/byte, putting thing where they need to go...AND'ing them out here, OR'ing them in there. Whatever works for you.

    So the bits in the 8 bytes look like:
    IIIIIIII IIIIIIII IIIIIIII IIIIHHHH HMMMMMMm mmmddddd yyyyyyRR RRxxxxxx
    I = ID
    H = hours
    M = minutes
    m = month
    d = day
    y = year (offset by 2008, add 2008 to the total)
    R = register
    x = spare

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    By efficient, I assume you are looking for utilising the EEPROM to its stated write endurance. I do recall having seen an article about this perhaps on this site. Or maybe, is it Microchip site?

    JF

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Thanks alot for skimask for the importnant information that clearify our problem

Similar Threads

  1. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  4. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 19:42
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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