non-volatile Variables - HOW??

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

non-volatile Variables - HOW??

1,919件の閲覧回数
toebsen
Contributor I

hi there

we have a problem storing variables in the flash of our S12XE100, we do not have any idea how we could achieve it. So Im asking, is there any easy way to save variables non-volatile, like a loader instruction or so? Do we really  have to implement the complex way with formating and Emulated EEPROM and stuff? Can you please show us some easy to implement way, perhabs with some code snippets?

Thanks for your time

 

Regards 

toebsen

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

985件の閲覧回数
jsmcortina
Contributor III

Yes, you need to use emulated EEPROM or come up with an erase/programme scheme for Dflash. Also be aware of what will happen if the power is shut off during a write cycle.

 

James

0 件の賞賛
返信

985件の閲覧回数
Lundin
Senior Contributor IV
That is only necessary if you want to change the values in runtime. Perhaps the original poster can clarify if that is required by the application or not.
0 件の賞賛
返信

985件の閲覧回数
Lundin
Senior Contributor IV
Make a memory segment in the .PRM file, then write

#pragma CONST_SEG name_of_segment

const int variable;

#pragma CONST_SEG DEFAULT

Obviously the variables have to be const. I always declare them at file scope too, or the compiler might put them on the stack instead of nvm.
0 件の賞賛
返信