You may use the GOSUB command when you want to jump to a SUB and then in an easy way get back to where you jumped from. The SUB you jump to can be anywhere in your program (before or after MAIN) as long as it has a unique name JUMPHERE: and the sub ends with a RETURN. Please remember PICs has a limited stack and can only make a few (depends on PIC version) nested GOSUBS before the first jump becomes invalid because you do a stack overflow. Same thing if you try a RETURN before you have made a GOSUB, that will give a stack underflow and will probably hang your program.
Bookmarks