I didn't get what you mean too. We were talking about WRITE/ERASE not self programming. I was confused that everytime the system edits the varaible ie string in cide memory, will it effect the storage of variable in long run ?
I believe what both FvM and I are attempting to convey to you is the following:
You can store the password in Code Memory (FLASH), however you will NOT be able to change/alter the password, unless you change the password within your program code, recompile and then reprogram the device.
In other words the password will be a constant and unalterable from within the program during runtime.
I believe your confusion stems from the fact the variable you refer to in the above quote is stored in volatile RAM, NOT in nonvolatile FLASH (Code Memory). And of course, any variable stored in volatile RAM, will be LOST when power is lost or the system reset.
The main point, both of us are attempting to convey, is the AT89S52 does not support modification of Code Memory (FLASH) from within the program, otherwise known as In Application Programming (IAP).
If you require a nonvolatile read/write storage for the password, then the use of an external device, like a Serial EEPROM, will be necessary.
Or change the design to utilize a different MCU which does support IAP or has built-in EEPROM.
BigDog