Hello friends I want to define 32bit(4 byte) value as a constant in flash. How to access it within a programm written in 'C' for 8051 microcontrolller. Please suggest me any solution.
Using the C language? Can I then hope that you have spent some time reading the manual for the C51 compiler? Notice that the manual describes how to tell the compiler if information should be stored in the code memory or in the different RAM regions.
By the way - your subject line says "read & write", while your message says "constant".
There are no general way for a program to write to the code memory. Some specific 8051 chips have methods, but only you know what model you are going to use - you didn't seem to think supplying the chip model was important for this thread.
Another thing is that the code memory can't normally modify just 4 bytes, even if the chip do support in-application programming (IAP) of the flash memory. And there are also limitations on how many times such a processor can rewrite a flash sector because of wear. And of course it isn't too good if the same flash sector both contains a constant that should be changed, and real code, unless you can make sure that the program never tries to run that code while you reprogram the sector.
Some 8051 processors have internal EEPROM memory, which is sometimes better suited for storing of configuration data that may have to be changed in field.
Respected Sir,
Thanks a lot for your valuable feedback.
I intend to set the 4-Byte (32-Bit) "constant" in the Flash Area of Silicon Lab's 8051F231 CPU. This "Constant" will be read in the operating software, to compare with the 32-Bit value to be received thru' serial port, with proper lsb to msb order. The Source Code is in "C" and the "Constant" is defined as an Unsigned Long Value.
I am sorry that the User Manual of the C51 has been misplaced.
I sincerely request you to please send me by e-mail, the English Language PDF File of the same. I searched the KIEL website, but the C51 User Manual was not locatable.
Thanks once again and with best regards,
- Arshad.
I searched the KIEL website, but the C51 User Manual was not locatable.
http://www.keil.com/support/man_c51.htm
I intend to set the 4-Byte (32-Bit) "constant" in the Flash Area of Silicon Lab's 8051F231 CPU how to described in excruciating detail in the datasheet.
Erik
many, case in point SILabs, manufacturers websites are so "salesman oriented" that to find a specific datasheet becomes a task
I have, as of late used the digikey website (select the chip, click on datasheet in the window that pop up). NOTE, as opposed to the datasheet collection websites, this takes you to the manufactureres website not to some "ancient saved datasheet".