Write text to eeprom

Discussion in 'Programmer's Corner' started by FroceMaster, Feb 18, 2012.

  1. FroceMaster

    Thread Starter Member

    Jan 28, 2012
    400
    4
    Hi.

    is it possible to "store" text, ex string like " Monday" into the EEPROM of a 16f`690
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    Yes of course. Strings are nothing but bytes but if you are just going to store days then why not store a pseudonyms / token instead?


    0x00 = Sunday
    0x01 = Monday
    0x02 = Tuesday

    and so on.

    Then your would simply translate that when it needs to be displayed.
     
    Last edited: Feb 18, 2012
  3. FroceMaster

    Thread Starter Member

    Jan 28, 2012
    400
    4
    yes i could do that, but it would be better to just read direct from eeprom, just to save space in 16f690, have plenty space in eeprom, but program space is nearly full,
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    But more complicated. A lot easier to store the token. I would doubt there would be too much of a coding size anyway. Remember you will still need to write a loop to store the string.
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Yes it is, and you will save program space as the actual string data is being saved in EEPROM as opposed to saving it in program space. Either way you may well be copying it to a RAM buffer to use it anyway.

    The strings have various lengths ( and always end in "day") so you need to encode the length also, just a zero is fine.

    You will also need a pointer to each of the strings. Again, you can trade wasted EEPROM for less ROM.
     
Loading...