Hello all, We have with us a AT89C51ED2 board with an external AT29LV020 flash. We have our CODE in the external flash. There are two types of data that we want to retain between system resets. One type of variables are those which will not change when the system resets. i mean they will be constants everytime we reset the boards. so we have decided to use const <datatype> code abc; so that they will not change and will be allocated in the ROM. Another type is that they might change during run time, and when the system resets, it must be able to get back the last value it was when the system was reset. For these kind of variables we write to the Internal Flash when the board resets using the IAP functions. First thing, are we doing it right, second, Is there any other way to store this data ? regards prasanna
Is there any other way to store this data ? Atmel has a 89c51xD2, I forget which, with an internal EEPROM that can be written as regular data. Erik
hi, Atmel has a 89c51xD2, I forget which, with an internal EEPROM that can be written as regular data. You talk about AT89C51ED2 which has 2kb of internal EEPROM and which the OP works with. Regards, Oleg
"First thing, are we doing it right, second, Is there any other way to store this data ?" Depends what you mean by 'right'. It would seem more logical to put your code in the internal flash and store your non-volatile data in the internal EEPROM. You wouldn't need to muck about with the IAP calls. "For these kind of variables we write to the Internal Flash when the board resets using the IAP functions." How do you buy the time to write these variables on reset?
hi, For these kind of variables we write to the Internal Flash when the board resets using the IAP functions. What do you mean with "the board resets"? Is it a simple reset button or do you talk about power switch off? In case of ordinary reset you need not to save data into non-volatile media. You may just keep them in (X)RAM because reset does not change RAM content. Of course you should edit startup file for remove that part of code which clears all the RAM there. In case you mean complex power-off then I may suggest to use external serial non-volatile memory. Depend on how often this task is needed, it may be SPI/IIC EEPROM or FRAM, RAM+Battary etc. Indeed, it may be parallel non-volatile memory as well. Regards, Oleg