This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Saving in 8051 IDATA starting from 92H

Hello,

I have the following line of code which I need to store in the IDATA memory starting from 92H.

char code *text_to_compare = "Tesing";

How can I achieve this please?

Parents
  • Use the code below:

    idata   unsigned char      imem[6] _at_ 0x92;        // creates 6 bytes of storage at 0x92 in
                                                         // idata space
    idata   unsigned char      *text_to_compare;         // creates pointer to idata memory
    
    
    text_to_compare = &imem;                             // assigns pointer to imem
    
    

    The _at_ allows you to assign absolute memory locations to variables.

    If you look at the pointers entry in the C51 manual it describes how to assign pointers to specific memory areas.

Reply
  • Use the code below:

    idata   unsigned char      imem[6] _at_ 0x92;        // creates 6 bytes of storage at 0x92 in
                                                         // idata space
    idata   unsigned char      *text_to_compare;         // creates pointer to idata memory
    
    
    text_to_compare = &imem;                             // assigns pointer to imem
    
    

    The _at_ allows you to assign absolute memory locations to variables.

    If you look at the pointers entry in the C51 manual it describes how to assign pointers to specific memory areas.

Children
No data