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
  • Why do you think you need two steps?

      xloc=(fun_ptr)s_addr;
      MyFunc=(fun_ptr) xloc;
    

    By the way - an address in XDATA will only match an address in CODE if the board you have maps them identically, i.e. if the 32 kB of RAM have the XDATA start address 0x8000 and you have hardware that maps it into the CODE address range 0x8000 to 0xFFFF, or the RAM have XDATA start address 0 and maps into CODE space 0x0000 to 0x7FFF. If there isn't a unity mapping when the RAM is accessed as XDATA or as CODE, then you can't just do a type cast - you must then also take into account an offset.

    Another thing - will your 32kB of XDATA-connected RAM map over the interrupt vectors? If not - what have you planned to do, to let a student create his own interrupt handler for a timer, UART etc?

    But the huge question to ask: How can there already exist hardware for this, without these problems already having been covered? There should be documentation telling what your board can do.

Reply
  • Why do you think you need two steps?

      xloc=(fun_ptr)s_addr;
      MyFunc=(fun_ptr) xloc;
    

    By the way - an address in XDATA will only match an address in CODE if the board you have maps them identically, i.e. if the 32 kB of RAM have the XDATA start address 0x8000 and you have hardware that maps it into the CODE address range 0x8000 to 0xFFFF, or the RAM have XDATA start address 0 and maps into CODE space 0x0000 to 0x7FFF. If there isn't a unity mapping when the RAM is accessed as XDATA or as CODE, then you can't just do a type cast - you must then also take into account an offset.

    Another thing - will your 32kB of XDATA-connected RAM map over the interrupt vectors? If not - what have you planned to do, to let a student create his own interrupt handler for a timer, UART etc?

    But the huge question to ask: How can there already exist hardware for this, without these problems already having been covered? There should be documentation telling what your board can do.

Children
No data