EEPROM Memory Question

jay4708

New Member
Hello,

I'm working on a keypad LCD alarm.

Is there a way to write a user code to EEPROM memory at the programming stage only? and that bit of code is then ignored when power is reset to the picaxe?

What I don't want to happen is the user code to be changed by the user (I've written this bit of the code and it all ok) and then when the power is reset the code is reset to the default code that was at the beginning of the program.

I tried doing it like this below but when I reset power the code went back to 1234.

data Code1Master,(1) ' Set the default value for data address 'Code1Master' to 1
data Code2Master,(2) ' Set the default value for data address 'Code2Master' to 2
data Code3Master,(3) ' Set the default value for data address 'Code3Master' to 3
data Code4Master,(4) ' Set the default value for data address 'Code4Master' to 4

For now I've removed the above bit of code and rely on the first code being 0000 after programming.

Thanks for any ideas and help,
John
 

erco

Senior Member
Sure, or you can simply define a user code as some variables or constants in the first part of your program. Works the same.
 

Technical

Technical Support
Staff member
data (eeprom) values are NOT reset when the chip is reset, it is a programming time 'preload' value. So it is reset when you do a new download, but not when the chip resets (e.g. battery reconnected).

To avoid it changing at new download add a #no_data directive

To change the values at runtime you must use read/write
 

erco

Senior Member
What technical said. Just hardcode unique user codes in the first part of your code when you program the chips. Done.
 
Top