Hi,
Am relatively new to the freescale devices and would like some advice. I would like to store some data in the Flash area (constant values) and am a little confused on how to do it. How would i store data in the flash area ?
Much appreciated
Hello, and welcome to the forum.
The programming of non-volatile parameters from within the user code is not really practical for MC9RS08 devices. To do so would require the switching of an external programming voltage.
A portion of the programming code then needs to be run from RAM. This code is relatively complex, and must generate critical timing intervals. The incorrect timing may permanently damage the flash memory. In addition, the programming of non-volatile parameters could be done only once because the only erase process available is a mass erase (which would also erase your code).
To do what you require, the use of a suitable MC9S08 device would be a far better choice.
Regards,
Mac
BigMac,
Not exactly what i was trying to do, i want to store some data in the flash area at compile time and then read them during program execution via a flash pointer, what i am struggling with is how to tell the compiler to store values in the flash area ie. config paramters for a radio device, i don't want to use ram space for what are constant values.
The device i am using is MC9RS08KA8.
Regards
Hello,
Assuming you are coding in C, simply define the variable name as constant, and specifiy a value for the variable.
const byte cvar1 = 10;
const word cvar2 = 1000;
Of course, more complex data types such as arrays and structures, are also possible. Another possibility, where the parameter of a function is a byte pointer to a string, the following string data is implicitly constant:
LCD_send( "MAIN MENU");
I always like to then verify that the variable has been placed in flash memory, by examining the project map file.
Regarda,
Mac
This topic gets discussed a lot in this forum. Use the search box at the upper right and try search phrases such as "flash programming" or "program flash" to display conversations on this subject. Also, when you do ask a question, please specify the part that you are using, as the programming techniques can vary.
---Tom