The stack is mainly used for storing temporary data, local variables, and return addresses after interrupts and subroutine calls. The Stack is implemented as growing from higher to lower memory locations. The Stack Pointer Register always points to the top of the stack. The Stack Pointer points to the data SRAM stack area where the subroutine and interrupt stacks are located.
The AVR Stack Pointer is implemented as two 8-bit registers in the I/O space. The number of bits actually used is implementation dependent.
Note: Data space in some implementations of the AVR architecture is so small that only the SPL (Stack Pointer Low) register is needed. In this case, the SPH (Stack Pointer High) register will not be present.
Stack Instruction Set
A stack PUSH command will decrease the Stack Pointer. The stack in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled. The initial Stack Pointer value equals the last address of the internal SRAM and the Stack Pointer must be set to point above start of the SRAM.