On 1 Sep 97 at 13:55, Steve Smith wrote: > I have a program which needs to return to stack level 0 from > different stack levels normally 2 to 5. Is there any way of purging > the stack or is it not necessary ? When in simulation MPLAB gives > stack overflow after a couple of itterations. The timer 0 and a > counter is used to recover to the main program loop if there has > been no user input for 30 seconds. The object was to stop user > leaving the module in a state where other inputs are ignored while > user sets up opperational parameters. This however exits to 'MAIN' > via a goto not a through clearing the stack properly. An exit to > 'DIRTY_EXIT' could be made then goto 'MAIN' but how do I clear the > stack from an unknown level (2-5) ? > How about enabling watchdog, making the user input reset the watchdog? That would force a reset, doing what you want. MikeS