Storing a string from code memory to IDATA memory in C (8051)

Status
Not open for further replies.

adrianvon

Member
I have the following code of line which stores the string TesT in the code memory of the 8051 micro-controller.

char code *text_to_compare ="TesT";

How can I store the same string in the IDATA memory starting from 92Hex?

Any kind of help would be highly appreciated.
Thanks in advance.
 
Which compiler??? SDCC uses the __at to specify an absolute address.. However!! char *text_to_compare = "Test"; will store the string in IDATA..

Some compilers use @ to absolute address....#

I don't think using a pointer will work..

char _at (0x92) text_to_compare[] = {"Test"};
char *pointer_to_text = &text_to_compare[0];

Now pointer_to_text is what you need....
 
Thanks for the reply. The thing is that i need it to start from 92hex. char _at (0x92) text_to_compare[] = {"Test"}; did not work. I am using the C51 compiler.
 

The syntax is slightly different for c51... The documentation is very good
https://www.keil.com/support/man/docs/c51/c51_intro.htm
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…