You can write in RAM like this :
//SOLUTION 1 :
//All pointer size depends of the machine.. (i.e 2 bytes)
char *memPtr;
char theContent;
unsigned short int memItr;
//Initialize ram (write) //0x1000 to 0x1010
//... We write to 16 locations
memPtr = (signed char*) 0x1000;
for (memItr = 0 ; memItr 16 ; memItr++)
{
(*memPtr) = 0x55; //Write an acsii char..
memPtr = memPtr + 1;
}
//Init the ptr and itr
memPtr = (signed char*) 0x1000; //Memory ptr
memItr = 0;
//Display
printf("Memory display (Ram 0x1000 to 0x1010)... ");
for (memItr;memItr16
{
memItr++; theContent = (*memPtr); //display the content.(HEX_TO_ASCII?)
memPtr = memPtr + 1;
}
//SOLUTION 2 :
char lFillRam[ARR_DIM]; //Array of character
for (memItr=0 ; memItr
{
lFillRam[memItr] = 'U';
}
If you want to write in Flash or Eeprom, you have to follow some special algorithm (procedure). See the AN for you MCU