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

XBANKING vs L51_BANK

I need to access 512k of XDATA, and it seems that there are two options: XBANKING.A51 and L51_BANK.A51. Does anyone have any experience/knowledge that would help me choose which is best to use? Basically, I want pros/cons/war stories for each method.

Thanks,
Greg

  • "I need to access 512k of XDATA, and it seems that there are two options: XBANKING.A51 and L51_BANK.A51."

    There's also a third option:

    Don't use either of the above; use your own scheme instead.
    This is fine if you have only a very simple requirement; eg a datalogger where you just start writing at address 0 in bank 0 and keep going, only switching banks when one is full and it's time to start the next.
    Thus the bank-switching is handled entirely by your application software.

    As ever, which is best for you will depend entirely on your particular requirements!

  • XBANKING has code just for data space banking to allow more than 64KB of xdata (far memory).

    L51_BANK has routines both program space banking, to allow more than 64 KB of code, and also xdata banking. This file is a little hard to read due to all the conditional compilation, but essentially it has one set of routines for data access, and another set for code access, with several options that let you enable code for common types of banking hardware without having to write code.

    The actual memory access routines in either are the same, so it's not a question of capability or feature set. If one of the "canned" styles of hardware matches your hardware, then those are the easiest to enable. XBANKING expects a byte register that lives in either SFR space or xdata space that controls the high order address bits. L51 is a little more powerful. But even the "code your own" interface (type 4 in L51) is not that hard to understand.

    Oddly enough, I use both. I started out with XBANKING, and then as the code grew, I added L51_BANK -- but with the xdata banking code in that file disabled.

  • "There's also a third option"

    To stay true to form, perhaps I should also add a 4th option:

    Choose a processor that can do it without any need for messing about with banking...
    ;-)