Hello ... i'm sorry for my bad english ... I write special app for NXP P89C51RD2BA microcontrollel. But I can't resolve next problem: When I try to define two arrays in far memory and try to write somthing them, they rewrite each other (seen in memory frame). I have next memory distribution: 1) External RAM: 128 Kb = 4 pages x 32 Kb (HDATA (X:0x00000-X:07FFF, X:0x10000-X:17FFF,X:0x20000-X:27FFF,X:0x30000-X:37FFF)) 2) And also XDATA (X:0x8000-X:0xFFFF) for communication with various circuit chips (MT8980 and others) 3) On-chip code memory: ECODE (C:0x0000-C:0xFFFF), HCONST (C:0x0000-C:0xFFFF) 4) X:0x80FE - the address for xdata banks swithcing (may be here the problem) In this regard, the following question: how use L51_BANK.A51 in this case properly (for this problem resolution).
May be somehow configurate the CPU.DLL:S8051.DLL parametres... If this problem can not be resolved... how to configurate XBANKING.A51 (or somthing others) for work with external switching port? is this possible?
After many compilations and mediation I understand, what this problem hidden in memory window, which can not look after switch address (X:0x80FE) and reflect my arrays in their locations. But disassembly code right. May be somebody know how solve this problem?
> how use L51_BANK.A51 in this case properly
Copy L51_BANK.A51 to your project folder, and rename it. Add renamed L51_BANK.A51 to your project. Open this file on uVision. You'll see "Configuration Wizard" tab under the edit pane. Switch to this tab.
Using this wizard, configure renamed L51_BANK.A51 as you like. For example,
Bank Configuration - ?B_MODE: Bank Switching via -- select "XDATA port" from the value pull-down (touch to value field) - ?B_VAR_BANKING -- check it - ?B_RST_BANK -- set to 0x00 Bank Switching via XDATA Port Address - P1: XDATA port address - 0x80FE
Add VARBANKING directive to the compiler option, and apply LX51 linker.
XBANKING.A51 supports bank switch via SFR register. Then, it doesn't fit to your configuration. Leave it alone.
Tsuneo
Hello, Tsuneo, thanks for Your reply. I'm already have read all manuals about code and xdata banking, and I already make all this configuration. Judge from disassembly code in real processor this will work properly, but with Keil uVision simulator it can't. For example, I've next easy application file main.c
unsigned char far ex_array0[0x8000]; extern unsigned char far ex_array1[0x8000]; extern unsigned char far ex_array2[0x8000]; void main(void) { unsigned int i, ex; for (i=0; i < sizeof(ex_array0); i++) { ex_array0[i] = i; ex_array1[i] = i+0x80; ex_array2[i] = i+0x81; ex = ex_array0[i]; } return; }
file variable1.c
unsigned char far ex_array1[0x8000];
file variable2.c
unsigned char far ex_array2[0x8000];
When I run debug session and direct mouse on some variable, in address-frame reflacting properly address of whose variable. But in memory window all changes occur in address 0x000000,0x000001... for example (for earlier app), after five steps (i=5) X:0x000000: 81 82 83 84 85 00 00 00 00 00 00 00 00 00 00 00 X:0x000015: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... Here addresses of ex_array0, but sense of ex_array2(((( Arrays have next addresses: ex_array0 - X:0x000000 ex_array1 - X:0x010000 ex_array2 - X:0x020000