View previous topic :: View next topic |
Author |
Message |
fuzzy
Joined: 26 Feb 2005 Posts: 64
|
write default data in int EEprom |
Posted: Wed Jun 28, 2006 10:06 am |
|
|
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
|
|
Posted: Wed Jun 28, 2006 10:14 am |
|
|
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
|
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Wed Jun 28, 2006 10:28 am |
|
|
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! |
|
|
|