protecting some values while changing the battery

i m working on a project with 89c51rd2.

my problem is how to store some datas in memory...

a passwoed for example,
i store a defult value for the password when i programming.
and i want the user can change the password.
but if the user shuts down the device or wants to change batteries
then the user works the device again, the password will take the default value again.

how can i solve this?
im using C language with keil.

i cant store any values in code memory. can the data memory remember the value?

Where is the 8051's static memory?

i want to select an address an store the password there. and i wont use a default value.
But the problem is which memory of 8051 should i use, and how can i use it.

i wanna select an address and when program starting up i will check that address, if there is no value, i will store 1234 value into there as password. when user wants to change the password i will change the value of that address.

well can i select an address in code segment(or any memory space which dont forget the value) and how can i store a value into there?
eg. i wanna store a byte to FFF0 address in code segment. is it possible?

Parents
  • i was trying for a week. but no step i took.
    i saw many sources. and i found some helps.

    Keil clears all memory spaces with the file "STARTUP.A51" while starting up the device.
    Somebodies told that if i modify this file as i want, keil will not clear the memory while starting up.

    But nobody told how to do it. :D
    i copy the STARTUP.A51 file under C51/LIB. and paste under my project directory. And i add that file to my source group. i want to modify it.
    my problem is: Which changings should i do on it?
    if anybody knows, please helpp...

Reply
  • i was trying for a week. but no step i took.
    i saw many sources. and i found some helps.

    Keil clears all memory spaces with the file "STARTUP.A51" while starting up the device.
    Somebodies told that if i modify this file as i want, keil will not clear the memory while starting up.

    But nobody told how to do it. :D
    i copy the STARTUP.A51 file under C51/LIB. and paste under my project directory. And i add that file to my source group. i want to modify it.
    my problem is: Which changings should i do on it?
    if anybody knows, please helpp...

Children
More questions in this forum