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 CCS Technical Support

write default data in int EEprom

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



Joined: 26 Feb 2005
Posts: 64

View user's profile Send private message

write default data in int EEprom
PostPosted: Wed Jun 28, 2006 10:06 am     Reply with quote

HI,

I need to write 1 byte in my PIC internal eeprom only when i download firmware on my PIC. then my PIC must be able to change it forever during execution.something like a default password that can be changed.

how can i do it?
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 28, 2006 10:14 am     Reply with quote

If your programmer is also clearing the EEPROM (0xFF) then you could add code to your initialization routine to look for a 0xFF in the password locations, indicating they had been cleared. Then if it finds 0xFF, the PIC would re-write the default password.

Keep in mind that if you hard-code the default password into the firmware and don't set the read-protect bits, somebody might be able to work out your scheme by examining the extracted code.

Alternatively, depending on your programmer, you could specify a default EEPROM image to be loaded but that will probably require an extra step during programming.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 28, 2006 10:23 am     Reply with quote

Search the forum! It has been posted many, many times. You will use the #ROM statement. Something like this:

http://www.ccsinfo.com/forum/viewtopic.php?t=19607&start=1

Note that the location is different on some chips.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 28, 2006 10:28 am     Reply with quote

Wasn't there a recent compiler issue where the #rom pragma wasn't working right. Something about the HEX file was screwed up and the eeprom data wasn't in the right place.

Or am I confusing multiple problems?
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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