0% found this document useful (0 votes)
945 views

Push Andvpop Instructions in 8051 Microcontroller

The PUSH and POP instructions are used to store and retrieve data from the stack in the 8051 microcontroller. PUSH copies data to the stack and increments the stack pointer, while POP copies data from the stack and decrements the stack pointer. The stack pointer register points to memory locations 07H-FFH for stack operations. PUSH pushes data onto the stack by incrementing the stack pointer and storing the data, while POP pops data off the stack by retrieving the data and decrementing the stack pointer.

Uploaded by

ee210150900103
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
945 views

Push Andvpop Instructions in 8051 Microcontroller

The PUSH and POP instructions are used to store and retrieve data from the stack in the 8051 microcontroller. PUSH copies data to the stack and increments the stack pointer, while POP copies data from the stack and decrements the stack pointer. The stack pointer register points to memory locations 07H-FFH for stack operations. PUSH pushes data onto the stack by incrementing the stack pointer and storing the data, while POP pops data off the stack by retrieving the data and decrementing the stack pointer.

Uploaded by

ee210150900103
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

', "- \..· p- • .

/ \

/.. MIC ROC


. )· l .· .
~
ONf
-
RO~ ~
rR
-_ PUSH & POP Instr uctio n
8051 Micr ocon troll er
(Hin di) Lecture -19
PUSH & POP.Instruction
This two are stack related instruction.
• Stack is a section of a RAM, there are registers inside the CPU
to point to it.
• The register used to access the stack is known as the stack
pointer register.
• The stack pointer in the 8051 is 8-bits wide, and it can take a
value of 00 to FFH.
• When the 8051 is initialized, the SP register contains the value
07H.
• The storing operation of a CPU register in the stack is
known as a PUSH and before pushing data SP is
incremented by ONE automatically.

• Getting the contents from the stack back into a CPU
register is called a POP and after retrieve data SP is
decremented by ONE automatically.
• When the 8051 is initialized, the SP register contains the
value 07H.
• This means that the RAM location 08H is the first location
used for the stack to store data.
I
I
Last In - First Out
Push Pop

o.aa.r., 1 DlllaEJenwlt

Data fllfflltll

DataSlnw lt

DetaEJemont

Data a.men,

Stack Stack
I

a) PUSH Instruction: This instruction is used to copies data from


the source address into the stack. Using push operation stack
pointer increasi'd first and then content of register or memory will
store on that stack location which stored in SP.
EX . MOV R6,#'2SH
MOV R1,• 12H
MOV R4,•0FJH
PUSH 6
PUSH 1
PUSH 4
After PUSH 6 After PUSH 1 After PUSH 4

1
. F3

• • ·' 12 •. 12

': 25 ': 25 •: 25

Start SP • 07 Start SP • 08 Start SP • 09 Start SP • 0A


b) POP Instruction : POP instruction is used to copies data from
the stack to the destination address. In POP retrieve data first and
then stack pointer decreased by one.

EX. POP 4 ; POP stack into R4


POP 1 ;POP stack into Rl
6 ; POP stack into R6

.
After POP 3 After POP 5 After POP 2

:;
"i4

•• F9 0 F9
••
.:
76

6C
76

6C

Start SP = OB... , Start SP = OA Start SP = 09 Start SP = 08

You might also like