You will have to write a FLASH programming routine to Erase and Store your variables before the power down. The tricky part is that you can not Erase and Program the FLASH while running code from it. You will need to copy a small programming routine into RAM then call this the RAM Function. Once the variables are writen you can do a Return and go back to running code out of the FLASH array.
You should be able to find application notes regarding this.
Hiya,
Indeed Technoman !
You have software drivers which handle Flash Programming.
HCS08SGFNVMSSD
Standard Software Driver for HCS08 SGF Flash
Program/erase software driver for SGF NVM (flash and EEPROM) in HCS08.
I also need to pinpoint that you CANNOT execute/read from a Flash block you are programming to.
However, the S08GT60 includes several blocks to get the total size. Therefore you can execute from one flash block your code whilst you are storing your variables in another one.
Also, when a MCU has E²PROM or emulated E²PROM, it is preferable to use it rather than Flash to store variables. Because it's usually easier to handle !
Please have a look at the Flash/E²PROM drivers included and tell us how you get on !!!
Cheers,
Alban.
Alban wrote:However, the S08GT60 includes several blocks to get the total size. Therefore you can execute from one flash block your code whilst you are storing your variables in another one.
Does it?
Not that I can find any reference to, please explain.
Regards Peg
Hi Alban,
Alban wrote:I'll check on Monday with the engineer who told me that...As you mention, there is only one set of Flash registers.However, I know it's not only one array physically.I need to comfirm with him if these arrays are separated High Voltage wise and also know their number to have their boundaries.To Be Continued
Any word yet?
Regards Peg
Finally...
I misunderstood my colleague.
There's only one charge pump for a whole 60KB array. You do need to execute Flash Programming Routines from RAM!
Alban.