Stack Pointer (Sp) And Call Stack - Oki ML63611 User Manual

Table of Contents

Advertisement

2.2.7 Stack Pointer (SP) and Call Stack

The stack pointer (SP) is a pointer that indicates the call stack address where the program counter is saved when a
subroutine call or interrupt occurs.
The SP is a 4-bit up/down counter that is incremented during stack saves and is decremented during stack restores.
The call stack has 16 levels from address 0H to address 0FH. Because the hardware requires 1 level of the call
stack during program execution, only 15 levels can be used for stack saves. The contents of the call stack cannot
be read or written by the program.
Figure 2-3 shows the relation between SP and the call stack.
3
Stack pointer
SP is assigned to special function register (SFR) address 0F7H.
SP (0F7H)
(R)
At system reset, SP is initialized to "0" and points to address "0H" of the call stack. SP is a read-only register and
writes are invalid.
OPTION A (C): 1.5 V (3.0 V), Without regulator
circuit for LCD bias
2
1
0
SP
Figure 2-3 Relation between SP and Call Stack
bit 3
SP3
Chapter 2 CPU and Memory Spaces
Call stack
15 bits
bit 2
bit 1
SP2
SP1
2 – 5
OPTION B (D): 1.5 V (3.0 V), With regulator
ML63611 User's Manual
0FH
16 levels
0H
bit 0
SP0
circuit for LCD bias

Advertisement

Table of Contents
loading

Table of Contents