Reserve space at the FLASH for MyData[] - MC9S08GB60

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

Reserve space at the FLASH for MyData[] - MC9S08GB60

1,076 次查看
LYM
Contributor I

I use MC9S08GB60
How reserve space at the FLASH memories for my data so that code of program was not written in this area

 

 

 

 

 

 

Added p/n to subject.



Message Edited by NLFSJ on 2008-06-26 11:09 AM
标签 (1)
0 项奖励
回复
2 回复数

355 次查看
Ake
Contributor II
Hello,
The following program stores the string "This text..." in Flash EPROM.
It is copied into the RAM based string YourData[].
What is required is the word "const" ahead of the declaration.
 
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */

char unsigned x;
char YourData[10];

const unsigned char MyData[] = {"This text is stored in Flash EPROM"};

void main(void) {
 
  EnableInterrupts; /* enable interrupts */

  for(;:smileywink: {
  for ( x = 0;x< 10;x++) YourData[x] = MyData[x];
    __RESET_WATCHDOG(); /* feeds the dog */
  } /* loop forever */
}
Was this what you were looking for?
 
Regards,
Ake
0 项奖励
回复

355 次查看
LYM
Contributor I
no, I want to save variable in NVRAM during performing the program
0 项奖励
回复