Reserve space at the FLASH for MyData[] - MC9S08GB60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reserve space at the FLASH for MyData[] - MC9S08GB60

1,168 Views
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
Labels (1)
0 Kudos
Reply
2 Replies

447 Views
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 Kudos
Reply

447 Views
LYM
Contributor I
no, I want to save variable in NVRAM during performing the program
0 Kudos
Reply