Central processing unit
ST7LITE20F2 ST7LITE25F2 ST7LITE29F2
The stack is used to save the return address during a subroutine call and the CPU context
during an interrupt. The user may also directly manipulate the stack by means of the PUSH
and POP instructions. In the case of an interrupt, the PCL is stored at the first location
pointed to by the SP. Then the other registers are stored in the next locations as shown in
Figure 11:
● When an interrupt is received, the SP is decremented and the context is pushed on the
stack.
● On return from interrupt, the SP is incremented and the context is popped from the
stack.
A subroutine call occupies two locations and an interrupt five locations in the stack area.
Figure 11. Stack manipulation example
CALL
Subroutine
Interrupt
Event
PUSH Y
@ 0180h
POP Y
IRET
RET
or RSP
SP
SP
PCH
@ 01FFh PCL
SP
CC
A
X
PCH
PCL
PCH
PCL
Stack higher address = 01FFh
Stack lower address = 0180h
SP
Y
CC
A
X
PCH
PCL
PCH
PCL
CC
A
X
PCH
PCL SP
PCH
PCL
PCH
SP
PCL
32/166
Doc ID 8349 Rev 5