EEE 15EE63C U2 S11 Sy
EEE 15EE63C U2 S11 Sy
UNIT 2
Session 11
The stack is a section of a RAM used by the CPU to store information such as data or
memory address on temporary basis. The CPU needs this storage area considering
limited number of registers.
STACK in 8051
The register used to access the stack is called the SP (stack pointer) register
The stack pointer in the 8051 is only 8 bit wide, which means that it can take
value of 00 to FFH
When the 8051 is powered up, the SP register contains value 07.
RAM location 08 is the first location begins used for the stack by the 8051.
The storing of a CPU register in the stack is called a PUSH
SP is pointing to the last used location of the stack
As we push data onto the stack, the SP is incremented by one
This is different from many microprocessors
Loading the contents of the stack back into a CPU register is called a POP
With every pop, the top byte of the stack is copied to the register specified by
the instruction and the stack pointer is decremented once.
When the 8051 is initialized, the SP register contains the value 07H. This means that
the RAM location 08 is the first location used for the stack. The storing operation of
a CPU register in the stack is known as a PUSH, and getting the contents from the
stack back into a CPU register is called a POP.
The following examples illustrates the Stack, Stack pointer, PUSH and POP
operations :
PUSH 6
PUSH 1
PUSH 4
PUSH 3
PUSH 5
PUSH 2
Reference Books:
1. The 8051 Microcontrollers-II edition-Kenneth j Ayala. Perram Publications.
2. Embedded system Design-Frank Vahid /Tony Givargis WSE. Wiley Publications.
3. 8051 Microcontroller-Hardware, Software and applications-V Udayashankara / M
S Mallikarjunaswamy - Tata McGraw Hill.
e- Resources:
1) YouTube videos on interfacing various peripherals and devices
2) www.microdigital.com
XXXXXXXXXXXXXXXXX