Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Hardware Stacks Question

Status
Not open for further replies.

Luis Daniel Bolaños

Member level 2
Member level 2
Joined
Apr 4, 2014
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Visit site
Activity points
342
Hello everybody,

I'm learning about the PIC16F887 and trying to understand the concept of the 8 levels stacks of memory.

As far as I understand the stacks save the return point for a subroutine to keep working. So if I have 8 levels, I could only create 8 subroutines each one inside the other, is that right?

I don't get much about the concept. I need a simple explanation.

Thanks!!
 

The following reference manual contains an in-depth discussion concerning the midrange PIC stack along with many other topics:

Reference: PICmicro MID-RANGE MCU FAMILY, Section:6.2.5 Stack, Page: 6-6

6.2.5 Stack

The stack allows a combination of up to 8 program calls and interrupts to occur. The stack contains
the return address from this branch in program execution.

Mid-Range MCU devices have an 8-level deep x 13-bit wide hardware stack. The stack space is
not part of either program or data space and the stack pointer is not readable or writable. The PC
is PUSHed onto the stack when a CALL instruction is executed or an interrupt causes a branch.
The stack is POPed in the event of a RETURN, RETLW or a RETFIE instruction execution. PCLATH
is not modified when the stack is PUSHed or POPed.

After the stack has been PUSHed eight times, the ninth push overwrites the value that was stored
from the first push. The tenth push overwrites the second push (and so on). An example of the
overwriting of the stack is shown in Figure 6-3.

...
...
...


BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top