0
19kviews
What is stack? How it is implemented in 8051?
1 Answer
2
1.0kviews

Stack: The stack is a section of RAM used by the CPU to store information temporarily information could be data or an address.

  1. The register used to access the stack is called stack pointer register.
  2. Stack is used to store data temporary during any program execution.
  3. The 8 bit stack pointer is used to hold an internal RAM address which is called the top of stack.
  4. Generally 8051 used bank1 of internal RAM as the stack so the default stack pointer is 07H.
  5. The stack pointer in the 8051 only 8 bit wide which means that it can take value of 00 to FFH.
  6. When the 8051 is powered up the sp register contain value 07H.
  7. RAM location 08H is the first location begin used for the stack by the 8051.
  8. When data is retrieved from the stack the byte is read from the stack and then sp register increment.
  9. The stack is used during PUSH, POP, CALL, RET instruction.
  10. Stack pointer work on the principal of last ID first output (LIFO).

enter image description here

Please log in to add an answer.