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

on-chip xram

hello everyone,
i am quite new to programming 8051..hoping to receive some help..
i have a pointer variable.The address stored in this variable resides in the on-chip XRAM.

unsigned char xdata *xloc;

i need the control of my program to be transferred to this address..how can it be done in C???
Thank You in advance for the help..

Parents
  • i tried using a function pointer...

    static unsigned int s_addr;
    unsigned char xdata *xloc;
    void (far *MyFunc)(void)=(void far*)(xloc);
    
    void main (void)
    {
      s_addr=get_addr();
      xloc=(unsigned char xdata *)s_addr;
      (*MyFunc)();
    }
    


    but the 3rd line shows error
    MAIN.C(30): error C141: syntax error near '*', expected ')'
    MAIN.C(30): error C129: missing ';' before ')'
    get_addr() is a function which returns the address to which i need to make the jump...

Reply
  • i tried using a function pointer...

    static unsigned int s_addr;
    unsigned char xdata *xloc;
    void (far *MyFunc)(void)=(void far*)(xloc);
    
    void main (void)
    {
      s_addr=get_addr();
      xloc=(unsigned char xdata *)s_addr;
      (*MyFunc)();
    }
    


    but the 3rd line shows error
    MAIN.C(30): error C141: syntax error near '*', expected ')'
    MAIN.C(30): error C129: missing ';' before ')'
    get_addr() is a function which returns the address to which i need to make the jump...

Children
No data