MC9S08SH8 - How to save data in Flash Memory

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MC9S08SH8 - How to save data in Flash Memory

19,794 次查看
cremonezi
Contributor I

Hi,

 

I'd like to save some data of my application in the flash memory of MC9S08SH8.

 

The user of application should be able to choose a new value while the application is running and the application should be able to keep this data in the non-volatile memory.

 

Is there any example of how to save data in the flash memory (as an EEPROM)?

 

Thank you, in advance.

标签 (1)
0 项奖励
1 回复

285 次查看
bigmac
Specialist III

Hello,

 

If you search this forum, you should find numerous examples of programming non-volatile data to a flash block, from within an application.  This is a very frequent request.  The datasheet for the device details the erase amd programming algorithms used, and provides flow diagrams.

 

Some basics to keep in mind -

  1. The minimum block size for erasure is 512 bytes.
  2. Flash memory within the same flash array is inaccessible during the erasure or byte programming process, so the code for these operations must be transferred to RAM, and run from there.  The device you are using, along with most other HCS08 devices, has only a single flash array.
  3. The RAM based code may be either pushed onto the stack, or alternatively occupy a fixed block of RAM.  The size of the block is quite variable, depending on the specific implemtation.  For the 'SH8 device, the minimum is about 20 bytes of code.
  4. Interrupts need to be globally disabled during the erasure or byte programming process.

 

Regards,

Mac

 

0 项奖励