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.

microcontroller stack operation.

Status
Not open for further replies.

jaga123

Member level 1
Member level 1
Joined
May 16, 2011
Messages
32
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
india
Activity points
1,533
i am using AT89S52 mcu. And i am working on memory. i want to know about stack.
can anybody give some general idea regarding stack operation including problems..

likes:
how it work , its function, its best uses and also problem regarding stack ?
 

Stacks are generally used for subroutine calls. When a subroutine is called, the RETURN ADDRESS, i.e. the place where the program should go after finishing the subroutine, is 'pushed' onto the stack. When the subroutine is finished, it 'pops' the address off the stack and puts it into the program counter.

The biggest problems with stacks is stack overflow. For example, if you've only got 8 memory locations allocated for the stack, but you perform 10 subroutine calls, the stack will get overwritten and you'll lose one of your return addresses.
 

Stacks are generally used for subroutine calls. When a subroutine is called, the RETURN ADDRESS, i.e. the place where the program should go after finishing the subroutine, is 'pushed' onto the stack. When the subroutine is finished, it 'pops' the address off the stack and puts it into the program counter.

The biggest problems with stacks is stack overflow. For example, if you've only got 8 memory locations allocated for the stack, but you perform 10 subroutine calls, the stack will get overwritten and you'll lose one of your return addresses.

thank you sir for your answer.
can you tell me how i use this to save memory in my program?

regards.
 

I'm afraid I don't understand your question about 'saving memory'. Stack IS memory. If you mean storing variables on the stack, that is done use PUSH and POP operations.
 

I'm afraid I don't understand your question about 'saving memory'. Stack IS memory. If you mean storing variables on the stack, that is done use PUSH and POP operations.

sir i am asking about memory management in mcu .

sir i have to store some data in eeprom of mcu but that data is more than eeprom storage capacity. so i am stack here , i cant found any idea how i use memory smartly.

please suggest me a way.
thank you..
 

If you have more data than memory, then you are in trouble. This is fundamental to life on my planet, and has nothing to do with electronics, memory or anything else; you just can't put 2Kg in a 1Kg bag.

Your only solution is to use some kind of data compression .
 

yes sir i am agree with you , that its hard to pack when maximum limit is over.
i am also searching for some data compression technology..
please suggest something useful.
 

thank you , how can i implement huffman coding in microcontroller.
any coding example available ... that will be more helpful.


thank you.
 

ops..
i afraid that implementation with microcontroller related note is hard to find.

ok i find out
thank you.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top