CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to clear all eeprom using one command?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
FFT



Joined: 07 Jul 2010
Posts: 92

View user's profile Send private message

How to clear all eeprom using one command?
PostPosted: Mon Oct 25, 2010 8:22 am     Reply with quote

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: 19333

View user's profile Send private message

PostPosted: Mon Oct 25, 2010 8:42 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 25, 2010 9:21 am     Reply with quote

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: 19333

View user's profile Send private message

PostPosted: Mon Oct 25, 2010 10:10 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group