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

Which bytes of XDATA will be used when switching the code bank?

I used the file: L51_BANK.A51,
and configurated it as following:

;************************ Configuration Section *******************************
?B_NBANKS       EQU  8    ; Define maximum Number of Banks                    *
;                         ; following values are allowed: 2, 4, 8, 16, 32, 64 *
;                         ; for BL51 the maximum value for ?B_BANKS is 32     *
;                         ; for LX51 the maximum value for ?B_BANKS is 64     *
;                                                                             *
?B_MODE         EQU  1    ; 0 for Bank-Switching via 8051 Port                *
;                         ; 1 for Bank-Switching via XDATA Port               *
;                         ; 4 for user-provided bank switch code              *
;                                                                             *
?B_RTX          EQU  0    ; 0 for applications without real-time OS           *
;                         ; 1 for applications using the RTX-51 real-time OS  *
;                                                                             *
?B_VAR_BANKING  EQU  1    ; Variable Banking via L51_BANK (far memory support)*
;                         ; 0 Variable Banking does not use L51_BANK.A51      *
;                         ; 1 Variable Banking uses this L51_BANK.A51 module  *

  • Refer to the example in the folder:

    Keil\c51\Examples\FarMemory\4MB Variables on Classic 8051.

    It has almost the same configuration and shows the relevant settings for the LX51 Linker/Locater CLASSES directive.

  • Read a bit further in L51_BANK.A51, and you will see the place where you need to define the xdata address containing the bank switch hardware.

    IF  ?B_MODE = 1;                                                              *
    ;-----------------------------------------------------------------------------*
    ; if ?BANK?MODE is 1 define the following values                              *
    ; For Bank-Switching via XDATA Port define XDATA Port Address / Bits          *
    ?B_XDATAPORT    EQU     0FFFFH   ; default is XDATA Port Address 0FFFFH       *
    ?B_FIRSTBIT     EQU     0        ; default is Bit 0                           *
    ;-----------------------------------------------------------------------------*
    ENDIF;