A96G140/A96G148/A96A148 User’s manual
20 Development tools
255
20.2.4
Extended stack pointer of 94/96/97 series core
The M8051 uses IRAM area for Stack Pointer. However, 94-series and 97-series microcontrollers use
both IRAM area and XRAM area for the Stack Pointer by configuring additional registers.
The XSP and XSPCR registers are involved in this functionality as described below:
By configuring the XSP/XSPCR register, you can use the XRAM area for the Stack Pointer.
—
The XSPCR decides whether to use XRAM for the Stack Pointer.
If XSPCR =
’
0
’
, the IRAM is available for the Stack Pointer.
If XSPCR =
’
1
’
, the XRAM is available for the Stack Pointer.
—
The XSP decides a position of XRAM Stack Pointer.
This is valid only if XSPCR =
’
1
’
.
Figure 133. Configuration of Extended Stack Pointer
STACK_POINTER = {XSP[7:0],SP[7:0]} = XRAM_TOP
–
STACK_SIZE
Ex) If only 256bytes of XRAM is used for stack,
XRAM_TOP = 4K(0x0FFF)
STACK_SIZE = 256byte(0x0100)
XSPCR = 1, XSP = 0x0E
SP = 0xFF setting
Stack Pointer Position = 0x0FFF - 0x0100 = 0x0EFF
XSPCR = 0
0x00
0xFF
0x0000
XRAM_TOP
XSPCR = 1
XRAM
stack
Area
IRAM is used.
XRAM is used.
0x0EFF