Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/28/02 20:43
Read: times


 
#19164 - RE: ? on stack pointer
The instruction in fact sets the stack pointer to byte number 7 that falls into second register bank (first register). I believe that this is initial value in 8051 (not sure if all of them).


Anyway, for people used to some other Intel processors it is not always visible from the beginning that PUSH increments stack pointer while POP decrements it in 8051 (while 80x86 I belive works the other way around).

Amount of data for a stach? Watch it! As it's been said here already that's your responsibility. You have to know how big internal RAM for the stack in your microcontroller is as well as plan the stack carfully. I ususally reserve variables in register banks (if progam is not supposed to be "multitasking") or raight above all banks. After that I set stack in what's left. It is because you cannot fully predict how much space you will use on stack in your functions and running interrupts adds some random factor (interrupt procedures may need some stack either... at least for main program trace).




List of 5 messages in thread
TopicAuthorDate
? on stack pointer            01/01/70 00:00      
RE: ? on stack pointer            01/01/70 00:00      
RE: ? on stack pointer            01/01/70 00:00      
RE: ? on stack pointer            01/01/70 00:00      
RE: ? on stack pointer            01/01/70 00:00      

Back to Subject List