I am working on a project and would like to use a mico that supports J1850 and CAN protocols. I need to store data in the flash memory when an event occurs. I also need to store upto 5 data values one after another without erasing the previously stored data. Those data values can not be erased at any time. Can any one help me what mico I should use and how I can perform this function? Thanks Mike
I also need to store upto 5 data values one after another without erasing the previously stored data. Those data values can not be erased at any time. all(most all) Flashes erase to ff. use a scheme that does not allow ff as data, you can then erase at start and find first unused by searching for first ff in the flash there. Any location containing ff can be 'written to' since flash wrote can only change 1 to zero. Erik
Note that you can program (write) a given flash address multiple times. The one thing you cannot do is make a 0 bit a 1. That requires erasing the flash sector, which will set all the bits to 1. So, if you need all ones in your data, you could perhaps pick a location at an "in use" bitmap. 1 would represent "free", and 0 "used". Set the bits to zero as you accumulate your five items to keep track of which ones you have seen. Or, perhaps you can just assign each item an address (offsets into a table of parameters). If you are going to collect these five items repeatedly, then you might want some sort of journalling log that keeps a list of the sets of items. Ultimately you'll run out of space and have to erase a sector. You could use two flash sectors, and alternate between them, so as always to have a nonvolatile backup. A riskier strategy is to copy to RAM, erase flash, and restore. (This method risks losing your data if the power goes out; that may or may not be a problem for your application.)