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

Can I switch code bank as I wish in runtime.

I have a problem in using code bank.
Suppose I use 4 code banks, bank 0 as common area, and have a function A in code bank 2 at first. But at runtime, I wish get new version function A, but it couldn't be writen to code bank 2, so I put funtion A into code bank 3, and set a bit to tell which bank should be use when A is called.
Can it be done by software?

It's the example code of BANK_EX1. I guess I should modify the code. How to do it.

  ?B_SWITCH&N:
                MOV     R0,A
                MOV     A,#BANK&N
                MOV     DPTR,#?B_XDATAPORT
                MOV     ?B_CURRENTBANK,A
                MOVX    @DPTR,A
                MOV     A,R0
                RET
                ENDM

Thanks.

0