Saving string in 8051 RAM (using C)

Thread Starter

Dritech

Joined Sep 21, 2011
901
Hi all,

I have the following line of code which I need to store in the IDATA memory.

char code *text_to_compare = "Tesing";

How can I achieve this please?
I found examples but they are all in assembly language.
 

MrChips

Joined Oct 2, 2009
30,794
Specify both brand names.

Or you can try:

char text_to_compare[] = "Testing" @ 0x0090;

char text_to_compare[] = "Testing" at 0x0090;
 

Thread Starter

Dritech

Joined Sep 21, 2011
901
Unfortunately none of the above worked. If I remove the @0x0090 it is compiling normally and saving in IDATA, but not starting from 90H.
The micro-controller brand is Atmel and the compiler is Keil.
Thanks.
 

nitro2

Joined Nov 6, 2011
1
Thanks for the reply. Is there a way to start from memory location 90hex ?
Is it ok?
Code:
char *str_pt ;
str_pt = (char*) 0x0090;
str_pt[0] = 'T' ;
str_pt[1] = 'e' ;
str_pt[2] = 's' ;
str_pt[3] = 't' ;
str_pt[4] = '\0';
if you only want to declare it in idata:
char idata str_pt[] = "Test";
 
Top