GOTO main or RETURN - Question


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    14


    Did you find this post helpful? Yes | No

    Wink

    Having everything within the IF statements work fine. I am trying to get a good handle on subs.

    The return after the "END" did not work. THanks for the input it was worth a try. I am sure it is something simple I am missing. Just unsure what it maybe.

    Keith

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Well, you can only use RETURN when you have jumped to a routine with GOSUB - NOT when you jump to it with GOTO.

    Try:
    Code:
    Main:
    If Switch1 = 1 Then
      Gosub ServoCenter
    Else
      Low LED1
    EndIf
    
    'And so on...
    Goto Main
    END
    
    ServoCenter:
    'Code here
    RETURN
    
    'And so on....
    Edit: Oh well, was a bit late there I see....

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