Stack Memory
- Stack is a part of RAM used by the CPU to store information temporarily.
- Information may be either data or an address.
- CPU needs this storage area as there are only limited numbers of registers.
- Register used to access the stack is called Stack Pointer (SP).
- SP is an 8-bit register. It can take values of 00H to FFH.
- When 8051 is powered on, SP contains the value 07H.
- RAM location 08H to 1F (24 bytes) is used as stack by default.
- RAM location 30H to 7FH can be used as stack.
- User can initialize SP to desired location.
- Depending on the initial value of the SP, 8051 stack can have different sizes.
- Loading of data from CPU registers to the stack is done by PUSH instruction.
- Loading the contents of the stack back in to CPU registers is done by POP instruction.
- Stack grows upward; the SP is incremented before pushing and decremented after popping a value.
Related topics:
8051 Registers | 8051 Program Counter | 8051 R Registers | 8051 SFR | 8051 P Registers | 8051 Stack Pointer | 8051 Data Pointer | 8051 PCON Register | 8051 TCON Register | 8051 TMOD Register | 8051 Timer Registers | 8051 SCON Register | 8051 SBUF Register | 8051 IE Register | 8051 IP Register | 8051 PSW Register | 8051 A Register | 8051 B Register
List of topics: 8051
No comments:
Post a Comment