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.

why Stack pointr of 8051 increase after pushin in sum data

Status
Not open for further replies.

myths

Newbie level 5
Joined
Apr 10, 2007
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Gurgaon - INDIA
Activity points
1,360
hi again...
1 more doubt....
why is it so in 8051 that when we push sumthin into stack,...its SP is incremented by 1 while its just opposite in 8085 ,86 and others...

nybody can plz tell me...


thnx in advance
 

Re: why Stack pointr of 8051 increase after pushin in sum da

myths

I don't have experience in 8051 programing, but you have to see where the Stack pointer start, if it starts at the top of RAM it whill decrease aftet each push, but if start at 0 address it will increase after each push...



myths said:
hi again...
1 more doubt....
why is it so in 8051 that when we push sumthin into stack,...its SP is incremented by 1 while its just opposite in 8085 ,86 and others...

nybody can plz tell me...


thnx in advance
 

Re: why Stack pointr of 8051 increase after pushin in sum da

Pushing byte onto stack in C51 always will increment stack pointer (SP), because of C51 architecture.
After reset SP is equal to 0x07 and first pushed byte will be written at address 0x08, because at first SP is incremented and then byte is written at address SP points.
 

For ultimate answers on '51 architecture you should read the '51 "bible" (User Manual), for a set of links see **broken link removed**

wek
 

Re: why Stack pointr of 8051 increase after pushin in sum da

hey guyz
i know all this that when we push the data in stack, the SP of 8051 increments and its reset address is 0x07 so we 've to first increment the SP & then push the data in stack as the stack address starts from 08H ......but my question was that why it is made so unlike 8086 and all..where the SP decrements and the reset value of SP is the highest address of the stack...

i mean there must be some benefits in this type of architecture datz y it was made so i wanna kno that reason....


by the way thanks u all....
 

Re: why Stack pointr of 8051 increase after pushin in sum da

I don't think there was a real reason behind that. It can be implemented either way.

I can just speculate that the 8051 is strictly an embedded device and so an overflowing stack will not affect another program. In the case of the 80x86, which is a generarl-purpose microprocessor, you may have more than one program running in the same memory (RAM), which is also shared by the data space and the stack. An overflowing stack of a certain program would thus just affect its own program, not others.

Again, this is just my speculation, not necessarily the real reason why it was done that way.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top