EasyManua.ls Logo

Intel 8253 - PUSH and POP

Intel 8253
773 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XA User Guide 4-14 3/24/97
that time. Once the oscillator counter times out, the XA will execute the interrupt that woke it up,
if that interrupt is of a higher priority than the currently executing code.
Note that if an external oscillator is used, power supply current reduction in the Power-Down
mode is reduced from what would be obtained when using the XA on-chip oscillator. In this
case, full power savings may be gained by turning off the external clock source or stopping it
from reaching the XTAL1 pin of the XA. If the clock source may be turned off, it may be
advantageous to use Idle mode rather than Power-Down mode, to allow more ways of
terminating the power reduction mode and to avoid the 9,892 clock waiting period for exiting
Power-Down mode.
4.7 XA Stacks
The XA stacks are word-aligned LIFO data structures that grow downward in data memory,
from high to low address. This and some other details of the XA stack implementation differ
from 80C51 stack operation. Refer to the chapter on 8051 compatibility for a detailed discussion
of this topic.
The XA implements two distinct stacks, one for User Mode and one for System Mode. The User
Stack may be placed anywhere in data memory, while the System Stack must be located in the
first 64K bytes, i.e., segment 0.
4.7.1 The Stack Pointers
The XA has two stacks, the system stack and the user stack. Each stack has an associated stack
pointer, the System Stack Pointer (SSP) and the User Stack Pointer (USP), respectively. Only
one of these stacks is active at a given time. The current stack pointer at any instant (which may
be the SSP or the USP) appears as word register SP (R7) in the register file; the other stack
pointer will not be visible. The value of the PSW bit SM determines which stack is active (and
whose stack pointer therefore appears as R7). In User Mode (SM = 0), SP (R7) contains the User
Stack Pointer. In System Mode (SM =1), SP (R7) contains the System Stack Pointer. The XA
automatically switches SSP and USP values when the operating mode is changed. Note that the
terms “USP” and “SSP” are logical terms, denoting the value of SP (R7) in each mode.
Segments and Protection
The User stack is always addressed relative to the current data segment (DS) value. This is
consistent with each user task being associated with a specific data segment. Moreover, code
running in User Mode cannot modify DS, so there is no possibility of changing the segment in
which the stack resides within the User context. The System Stack must always be located in
segment 0, that is, the first 64K of data memory.
4.7.2 PUSH and POP
The PUSH operation is illustrated by Figure 4.10. The stack pointer always points to an existing
data item at the top of the stack, and is decremented by 2 prior to writing data.

Table of Contents