AnsweredAssumed Answered

HCS08- Stack Control

Question asked by Rafael Dazcal on Aug 30, 2010
Latest reply on Dec 1, 2011 by bigmac

Hi all,


How do I read the stack pointer address in a C language code? I am using the MC9S08LC60 MCU.


I wanted to have some control of my stack pointer where-abouts. I'm afraid it will overflow when I least expect it, specially since I have only estimated it, but am not sure at all how close to overflowing I actually am.


I have a timer interrupt, and I believe that's the most critical point, since it may be triggered when the main thread is in it's most nested condition (where stack is at it's lowest), so if I can detect the lowest stack value in that condition, I'll have a good estimate if my stack is well dimentioned.


If you have other stack control ideas, I'll be happy to hear them.


Thank you