Saving variables to eeprom - mc9s12c32

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Saving variables to eeprom - mc9s12c32

1,356件の閲覧回数
Shugie14
Contributor I

I have the hsc12mc9s12c32 and am trying to save a variable to eeprom (or flash) in case of power outage. I have seen some forum posts looking for the same thing, but no one seems to be able to point to a good tutorial. I have read the manual, but cannot find FDATA or FADDR registers anywhere in the c definitions in codewarrior. The application notes (especially flash.c) seem to be trying to do what I want, but it looks like they are just using a pointer to point to the memory block they want. This causes my program to die and me to have to reprogram the circuit. Can anyone point to a good place to look because I'm just getting more questions than answers. Saving a variable should be simple I would think.

 

 

 

 

 

Added p/n to subject.

Message Edited by NLFSJ on 2009-04-09 09:34 AM
ラベル(1)
0 件の賞賛
2 返答(返信)

355件の閲覧回数
jsmcortina
Contributor III

Take a look at AN2548. This is Freescale's serial monitor code, but includes flash erasing, writing and "DoOnStack" which you could re-use in your application.

 

James

0 件の賞賛

355件の閲覧回数
kef
Specialist I

First of all use search box at the bottom of this page.

 

FADDR and FDATA registers are of no use in normal chip modes

 

Most probably your program dies because flash is not readable while being programmed, and program routine should run from RAM. Also interrupts should be disabled while programming, because vectors also are sitting in flash and CPU won't read them properly while flash is being programmed.

0 件の賞賛