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

XRAM, XDATA adress space overlap

NXP(Philips) P89v51RD2 has extra 768bytes of internal data memory (XRAM) that is accessed indirectly with MOVX instruction. Address range for XRAM is 0x0000h to 0x02ffh.

The external data memory (XDATA) address range is 0x0000h-0xffffh. The MCU accesses the external memory if

1) address is 0x0300h or larger.
2) AUXR bit 1 (EXTRAM) is set to 1.

If AUXR bit 1 (EXTRAM) is reset to 0 internal data memory (XRAM) is accessed.

Thus the lower 300h bytes of data memory addresses overlap and the choice is made by AUXR bit 1(EXTRAM).

I wish to use both types of memory. Is there a way to set up the Keil compiler to set/reset the (EXTRAM) AUXR bit_1 so that correct memory is accessed.

  • So, effectively, you want to do XDATA Banking - where one "bank" of memory is the internal XDATA RAM, and the other "bank" is external RAM?

    "Is there a way to set up the Keil compiler"

    Check out the manual sections on data banking?

    Alternatively, just do it "manually"...

  • I wish to use both types of memory. Is there a way to set up the Keil compiler to set/reset the (EXTRAM) AUXR bit_1 so that correct memory is accessed.

    There is a way: xdata banking. But you need a much better reason than "I wish to" for that to be a sensible plan; it has be well into the "I absolutely have to, or this project won't work" region for the benefit being worth the price.

    If you have any external memory at all, that'll surely be a whole lot larger than those 3/4 KiB of internal XRAM. So you gain a vanishingly small amount of extra memory, in comparison, whereas the price for using it is a serious CPU overhead on each and every access to that banked region. Overall, it's just not worth it unless you've exhausted all other options of saving some memory elsewhere.

  • If AUXR bit 1 (EXTRAM) is reset to 0 internal data memory (XRAM) is accessed. for addresses below 300h, above that external RAM is accessed

    Erik