MS51
Nov. 28, 2019 Page 36 of 491 Rev 1.00
MS51 32K SERIES TECHNICAL REFERENCE MANUAL
On-Chip XRAM 6.1.6.2
The MS51 provides additional on-chip 2 Kbytes auxiliary RAM called XRAM to enlarge the RAM
space. It occupies the address space from 00H through FFH. The 2 Kbytes of XRAM are indirectly
accessed by move external instruction MOVX @DPTR or MOVX @Ri. (See the demo code below.)
Note that the stack pointer cannot be located in any part of XRAM.
XRAM demo code:
Assembler:
MOV R0,#23H ;write #5AH to XRAM with address @23H
MOV A,#5AH
MOVX @R0,A
MOV R1,#23H ;read from XRAM with address @23H
MOVX A,@R1
MOV DPTR,#0023H ;write #5BH to XRAM with address @0023H
MOV A,#5BH
MOVX @DPTR,A
MOV DPTR,#0023H ;read from XRAM with address @0023H
MOVX A,@DPTR
C51:
unsigned char temp; //define data variable
unsigned char xdata xtemp _at_ 0x23;//define variable at xdata 0x23;
xtemp = 0x5B; // write #5BH to XRAM with address @0023H
xtemp++;
temp = xtemp; //read from XRAM with address @0023H