GOTO main or RETURN - Question


Results 1 to 6 of 6

Threaded View

  1. #5
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Gosub return

    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.
    Last edited by sinoteq; - 31st January 2009 at 16:08.

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Making a menu
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 12th November 2008, 19:54
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts