Hi! I'm using XBANKING.a51 from "Keil\C51\Examples\FarMemory\3 XData Areas on T89C51RD2" for access to various types of memory MCU Atmel AT89C5131. I'm define memory model - Large, "User Classes" as: XDATA (X:0x008000-X:0x009FFE) // off-chip XRAM HDATA_EEPROM (X:0x020000-X:0x0207FF) // on-chip EEPROM HDATA (X:0x010000-X:0x0103FF) // on-chip XRAM And variables as: in file MAIN.c unsigned char *Pointer1, *Pointer2; unsigned char far onBufer; // on-chip XRAM unsigned char xdata offBufer; // off-chip XRAM unsigned code cBufer = "Welcome"; // on-chip ROM in file EEPROM.c #pragma USERCLASS (HDATA = EEPROM) unsigned char far EEBufer; // on-chip EEPROM I'm programming next code: Pointer1 = onBufer; // pointer to 0x01AABB Pointer2 = cBuffer; // pointer to 0xFFCCDD memcpy(Pointer1, Pointer2, 20); Compiling my program and view "Disassembly Window": ... Pointer1 = onBuffer; 908010 MOV DPTR,#Pointer1(0x8010) 7402 MOV A,#0x02 // on-chip EEPROM area !!! F0 MOVX @DPTR,A A3 INC DPTR 74AA MOV A,#0xAA F0 MOVX @DPTR,A A3 INC DPTR 74BB MOV A,#0xBB F0 MOVX @DPTR,A Pointer2 = cBuffer; A3 INC DPTR 74FF MOV A,#0xFF F0 MOVX @DPTR,A A3 INC DPTR 74CC MOV A,#0xCC F0 MOVX @DPTR,A A3 INC DPTR 74DD MOV A,#0xDD F0 MOVX @DPTR,A memcpy(Pointer1, Pointer2, 20); ... Where the bug or my error?
There is no particular reason why on-chip XDATA has to be HDATA, while off-chip is XDATA.
Presumably, you are looking at some specific case where this happened to be (or seem) convenient to whoever set it up?
I shall ask on another. I define variables as:
char xdata A; // locate in off-chip XDATA char far B; // locate in on-chip XDATA
If the model of memory LARGE and a variable is defined as char C; , then where is placed a variable? It is necessary for me that in on-chip XDATA.
"It is necessary for me that in on-chip XDATA."
If it is necessary, then just specify it explicitly. Simple.