Hello,
I can't find any example C code to read and/or write an 8051 internal flash memory. I'm using a C8051F353 and the micro datasheet doesn't explain very well how to do it. When the manual speaks about using the MOVX and MOVC instruction to respectively write and read is not clear. My requests are: 1) how to put the assembler code inside the C code 2) how to read and write a specific byte memory, ex: 0x0800 3) is it possible to do it only with C code?
Regards,
http://www.keil.com/support/man/docs/c51/c51_le_memareas.htm
http://www.keil.com/support/man/docs/c51/c51_le_memtypes.htm
Note that the 8051 architecture had no way to write to CODE space - it is strictly Read/Execute only:
www.8052.com/.../120112
http://www.8052.com/tutorial
The processor does not have any instructions to write to the code memory. But I assume this processor does what lots of other processors does - it allows a part of the XDATA address range to be mapped as overlapping the CODE memory region.
This allows XDATA writes to copy new contents to the code flash.
Obviously, the manual for the C compiler will tell you how you set up a pointer into code space (or an array), to allow reading of data from the flash using MOVC instructions. And the manual also contains information how to set up XDATA pointers (or an array), allowing you to write into XDATA using MOVX instructions.
"how to read and write a specific byte memory, ex: 0x0800"
This question can't be answered, since it assumes that there is one unique address 0x0800. But the existence for MOVX and MOVC is that the processor have multiple address ranges that are not overlapping, or in some situations just partially overlapping. So a "real" address for a 8051 chip must not only contain a numeric value but also the address space it relates to.
I can't find any example C code to read and/or write an 8051 internal flash memory. no such thing for "8051" it is derivative specific I'm using a C8051F353 and the micro datasheet doesn't explain very well how to do it. When the manual speaks about using the MOVX and MOVC instruction to respectively write and read is not clear. the manual "explains it very well" If you are serious about using this chip, you better make using the MOVX and MOVC clear.
My requests are: 1) how to put the assembler code inside the C code DO NOT!!!, if you need asm do it in a separate module 2) how to read and write a specific byte memory, ex: 0x0800 ralph = (char *) 0x8000; 3) is it possible to do it only with C code? yes
Erik
Erik,
You're using a moniker again.
It seems to be becoming quite a habit ;)
Cheers.
Was a long time since Erik added that "do" to his name.
It's a stupid bug design issue with this forum that when you start typing, you may get the input focus moved to the First Name field when the last part of the page have been fully loaded. So if the server or network for some reason is unreasonably slow, then these kind of things tends to happen with at least Firefox.
There are a number of variants of my name on this forum too, after similar incidents.
The problem is of course worst for people who are a bit impatient while waiting for the page to load fully, and who happens to write text without always looking at the monitor at the same time.
Next thing is that when you do notice this name accident, you need to make one more post to correct it. If you notice it after you have already posted, then you are likely to forget to correct it, the next time it's time to write another post.
when I caught the doo-doo :) I just went to 'settings' and removed it.
oddly enough I caught it on my last post previous to this one