I need technical support for the following: i am using KEIL3 and infineon XC161CJ microcontroller . i am facing a problem that i have to write dyanamic data using serial232 port from computer to microcontroller. this data should go in flash memory area online , sothat when it is powerd off this data will not be lost. again on poweron this data should be avalable. i am unable to define a dyanamic variable in flash memory for this purpose. kindly suggest c program to define a variable in flash area which will be available after power off condition. how to write, delete. erase this dyanamic variable? waiting for early reply... thanks and regards.. kamlesh verma Defence research and development organization ministry of defence government of india
i want to add in my problem that FLASH is onchip. there is a partition in memory that provides 128 and 4 kilobutys of flash memory. one i use to store program (128kbuty). other partition of 4kbyte i want to use for dyanamic variable.also how to define indirect addressing to access taht memory location (0xabcdef) in 16bit resister variable. kamlesh verma
Typically in Automotive applications this type of variable would be considered a "calibration constant" and declared as a "volatile const size_T var_name".
Typically you would group these together into a section or a class. Then specifically control the location via the linker to a sector that that only allows these variables (like one of the 8K sectors besides the first one).
Typically you would work with these variables using a calibration tool (from ETAS, ATI, Vector to name a few) with them "overlayed" to RAM. During this phase of your development you would typically be working with reference and working pages in RAM. Once you decide that you have the right values you would use the same routines that are used to erase and program the Flash as in other cases (of course the tools I mention before will do this automatically).
Maybe you want to go to some these vendor sites to read their literature to gain a better understanding if this is what you are looking for.
http://www.etas.com www.accuratetechnologies.com http://www.vector-cantech.com
thanks for reply. you are absouletly right. i need to store tank calibration data. card is not having external ROM due to size constraints. i can store data defining constant data types and then i can fuse into onchip flash with the help of emulator tool i am using to download my program as well. but, in field this has to be done without emulator. by pressing a switch, microncontroller calculates value and NOW IT IS TO BE STORED IN FLASH. so that after power off and again poweron, this location will be read and executed. NOW HOW TO STORE??? can i get C language code for this. kamlesh