We are using Philips 89C51X2BN in one of our micro-controller based FCT products. We are using PORT 3 pins (P3.2 and P3.3) for code and data banking.
There are 4 banks of 64K each for code. The code bank range specified is: 0x8000 - 0xffff Similarly, we have 4 banks used for data banking. The locate directives that we are using are as follows: XDATA: 0x0800- 0x7fff HDATA: 0x28000 - 0x2ffff, 0x38000 - 0x3ffff VAR_BANKING has been set to 1 in the L51_BANK.A51 file
We encountered a problem when we started using "far" memory type in our application for one of the data structures. The variable was being assigned the address 0x28Axxx The memory access failed to work. So, we simulated the application in KEIL and found that while generating the code for bank switching the bits of the port (port 3) were being cleared through the MASK value generated by the banking logic. Since this was happening on port 3, the READ and WRITE bits were being set to 0 at once. We shifted the entire banking logic onto port 1 and now our application is working fine.
Does this mean that we cannot use port 3 for port-pin based banking? Such information is not available anywhere in the help documents that I have gone through till now. Are we using some old version of KEIL library that has some bug in it?