| ??? 09/24/01 21:31 Read: times |
#15125 - RE: In wich way can I set SP ??? |
Hi Pablo,
on this forum we are talking about 8051 core, aren't we ? ;) After a hardware reset the stackpointer is always set to 07h which means without further manipulating the stack will start at 08h. You can change the position of the stackpointer by the instruction mov sp,#xxh were xx can be any position in internal ram. For example, if you use more than one registerbank, you HAVE to set the start of stack higher than 08h. And, if you want to use internal ram for variables, you have to set the start of the stack BEHIND the needed locations. You have to find out for your program what is the best start location. If you use many nested subroutines and/or do many 'push'es on the stack, the stackpointer must be initialised not TOO high in memory, for in that case you are risking stack-overflow which will result in unpredictable behaviour... For example, when using an 8051 with 128 bytes internal ram you can mov sp,#5fh so your stack is from 60h to 7fh. Read some documents about the 80C51 family architecture. You can find them by many manufacturers sites on the net. Or: search this forum with the search option for treats with webadresses. Or: ask Erik Malund ;-) Henk |
| Topic | Author | Date |
| In wich way can I set SP ??? | 01/01/70 00:00 | |
| RE: In wich way can I set SP ??? | 01/01/70 00:00 | |
| RE: In wich way can I set SP ??? | 01/01/70 00:00 | |
RE: In wich way can I set SP ??? | 01/01/70 00:00 |



