> -----Original Message----- > From: James Hillman [SMTP:james@IND-INTERFACE.CO.UK] > Sent: Monday, February 25, 2002 9:16 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: is it ok to have stack underflow ? > > In my 16F628 program I call a subroutine that waits for an event to > happen. > If the event does not happen within a certain length of time can I use a > goto instruction to restart the program from a known point, without using > a > return instruction to pop the return address back off the stack ? > I know this will cause a stack underflow(?) condition, but since the stack > is a circular buffer surely it won't matter because subsequent calls will > have the required return to go with them - or will it ? > In this case it's fine. As you say, the stack is circular so it dosen't matter where the PIC starts pushing within the buffer. Stack underflow is more RETURNS than CALLS, so this is technicaly overflow, as you are executing a CALL without the matching RETURN. Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu