View previous topic :: View next topic |
Author |
Message |
FFT
Joined: 07 Jul 2010 Posts: 92
|
How to clear all eeprom using one command? |
Posted: Mon Oct 25, 2010 8:22 am |
|
|
Hi,
I'm writing 0xFF to all eeprom space using
Code: | #rom getenv("EEPROM_ADDRESS") = {0xFFFF,0xFFFF,0xFFFF,0xFFFF,...,0xFFFF} // clear eeprom space |
But this is not so good idea.
Is there a replacement of that?
Last edited by FFT on Mon Oct 25, 2010 9:22 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Mon Oct 25, 2010 8:42 am |
|
|
Just set your programmer to erase the EEPROM on programming. It'll be cleared to all 0xFF's.
What you post will only 'clear' the EEPROM, when you program the chip, so why not just use the programmer's ability to do this instead?.
Best Wishes |
|
|
FFT
Joined: 07 Jul 2010 Posts: 92
|
|
Posted: Mon Oct 25, 2010 9:21 am |
|
|
Hi,
Actually I write some other values to eeprom after writing 0xFF
For example:
Code: | #rom getenv("EEPROM_ADDRESS") = {0xFFFF,0xFFFF,0xFFFF,0xFFFF,...
#rom getenv("EEPROM_ADDRESS") = "example example"
#rom (getenv("EEPROM_ADDRESS")+getenv("DATA_EEPROM")-(4)/*lenOFword*/)={"blab"}
|
But I want all the other cells to be 0xFF |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Mon Oct 25, 2010 10:10 am |
|
|
They will be if you select the erase option....
Remember what you write into the ROM statements, is just written to the chip when you program it, not at any other time. If the programmer erases the cells, and you then write to any others, the writing, comes after the erasure, so the other cells are blank. Blank on an EEPROM, is normally 0xFF (depends on the EEPROM technology).
If you have the erase already selected (it normally is by default), then the first set of writes does nothing (except potentially wasting write cycles of the EEPROM) - though better programmers are smart enough to not write cells unless they need to....
Best Wishes |
|
|
|