Memory Specific Pointer

Hi.
I m facing a problem regarding data reading from one memory to another via pointer.

I am using LARGE memory model for ROM & RAM. I defined one function in idata as below:

unsigned char func1(void) small {
unsigned char status;
unsigned char xdata *pSrc;
unsigned char *pDst;

pSrc = (unsigned char xdata *) &Obj_Xdata;
pDst = (unsigned char idata *) &status;

*pSrc = *pDst;
}

here, Obj_Xdata is a 1 byte data located in XDATA. But writting the code as above, i m not able to get the proper value of Obj_Xdata in the status variable.

Please suggest the way to achive this.

Parents
  • "not able to get the proper value of Obj_Xdata in the status variable."

    Then shouldn't that be:

    unsigned char func1(void) small {
        unsigned char status;
        unsigned char xdata *pSrc;
        unsigned char idata *pDst;
    
        pSrc = (unsigned char xdata *) &Obj_Xdata;
        pDst = (unsigned char idata *) &status;
    
        *pDst = *pSrc;
    }

Reply
  • "not able to get the proper value of Obj_Xdata in the status variable."

    Then shouldn't that be:

    unsigned char func1(void) small {
        unsigned char status;
        unsigned char xdata *pSrc;
        unsigned char idata *pDst;
    
        pSrc = (unsigned char xdata *) &Obj_Xdata;
        pDst = (unsigned char idata *) &status;
    
        *pDst = *pSrc;
    }

Children
More questions in this forum