Not all PIC stacks are 8 levels deep. Consult your data sheet to determine how many stack levels your PIC can handle... Douglas Wood Software Engineer dbwood@kc.rr.com Home of the EPICIS Development System for the PIC and SX http://epicis.piclist.com ----- Original Message ----- From: "wouter van ooijen & floortje hanneman" To: Sent: Sunday, May 20, 2001 2:41 AM Subject: Re: Question about call/return > > > Will it work? The question is: A subroutine is called by my > > > program lots of times. If a special condition is achived, can I use > "goto > > > start" and forget the return? will it bring me to a "stack overflow"??? > > > > If you don't return, then each call takes a stack level. > > When you run out, BOOM. > > It will work only when what you describe is done at the 'highest level', > meaning not in a subroutine that is itself called. Then return address just > stays on the stack, but it is never used. > > The PIC return stack is a simple push-when-call (or interrupt), pop-when > return. It is 8 levels deep, whatever was at level 8 is lost when you push a > new level 1. Whatever is at level 8 stays there when you pop. > > push(a): > s8 = s7 > s7 = s6 > ... > s2 = s1 > s1 = a > > pop(a): > a = s1 > s1 = s2 > .. > s6 = s7 > s7 = s8 > > Wouter > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body