Subroutine And Interrupt Hardware Stack - Atmel AVR AT90S1200 Manual

8-bit microcontroller with 1k byte of in-system programmable flash
Hide thumbs Also See for AVR AT90S1200:
Table of Contents

Advertisement

I/O Direct
Relative Program Addressing,
RJMP and RCALL
Subroutine and Interrupt
Hardware Stack
AT90S1200
8
Operands are contained in register r (Rr) and d (Rd). The result is stored in register d
(Rd).
Figure 9. I/O Direct Addressing
Operand address is contained in 6 bits of the instruction word. n is the destination or
source register address.
Figure 10. Relative Program Memory Addressing
Program execution continues at address PC + k + 1. The relative address k is -2048 to
2047.
The AT90S1200 uses a 3 level deep hardware stack for subroutines and interrupts. The
hardware stack is 9 bits wide and stores the Program Counter (PC) return address while
subroutines and interrupts are executed.
RCALL instructions and interrupts push the PC return address onto stack level 0, and
the data in the other stack levels 1 - 2 are pushed one level deeper in the stack. When a
RET or RETI instruction is executed the returning PC is fetched from stack level 0, and
the data in the other stack levels 1 - 2 are popped one level in the stack.
If more than three subsequent subroutine calls or interrupts are executed, the first val-
ues written to the stack are overwritten.
0838H–AVR–03/02

Advertisement

Table of Contents
loading

Table of Contents