I have studied that it is possible to write values in code memory during the execution time in A51.But when tried the test gets failed.If possible what is the actual procedure to do it?
I don't know where you "studied" that---but it's wrong. You can't write into code memory on any 8051 device. There simply is no opcode for that. What you can do is write into XDATA memory that mapped as both code and xdata memory at the same time, using address decoding / chip select logic external to the micro. Or, if you have the right type of 8051 derivative, you can execute some magic instructions that allow you to program the chip in situ, but that's not exactly "writing to code memory", either --- it's ISP (short for "in-system programming").
"If possible" As Hans-Bernhard has explained, it isn't. "what is the actual procedure to do it?" That would depend on your particular hardware configuration, and/or the particular 8051 derivative you are using.
http://www.keil.com/download/docs/8051_vonneumann.zip.asp Rgds Raj Shetgar
Hi, Well, it is possible only with devices which have built-in bootloader flash API (for example, Atmel Temics-formed devices such as (A)T89C51RB2/ RC2/ RD2/ ED2/ ID2/ AC2/ IC2/ CC01 etc). Such devices contain extra program called bootloader which provides in-system programming of device. Thanks for manufacturer, they install user API as well there. So, yes, it is possible to write program flash; read flash API/bootloader sources to understand how. Good days!
"it is possible only with devices which have built-in bootloader flash API" Not true: this might be the easiest way, but it's not the only way. with a suitable memory architecture you can do this on any 8051 - but it requires the user to provice the necessary hardware and software support.