Goto inside a gosub??? Problems...


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79

    Default Goto inside a gosub??? Problems...

    Hi...
    There are any problem putting a goto inside a gosub?
    Sometimes i have strange problems and i donīt see anything in my code that might cause this problems. The strange thing is sometimes doing the same precedure every thing works fine!
    The only thing i have doubts one goto inside a gosub...
    Regards

  2. #2
    PaulJC's Avatar
    PaulJC Guest


    Did you find this post helpful? Yes | No

    Default

    Post your code so people can have a look at it for you and then they may be able to provide an answer.

  3. #3
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    ...
    start:
    ...
    if portb.1 = 1 then
    gosub dez
    portc.1 = 1
    gosub dez
    portc.2 = 1
    gosub dez
    portc.3 = 1
    gosub dez
    portc.4 = 1
    gosub dez
    endif

    dez:
    for i = 1 to 20
    pause 10
    if portb.2 = 1 then
    goto start
    endif
    next i

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by leonel
    ...
    start:
    ...
    if portb.1 = 1 then
    gosub dez
    portc.1 = 1
    gosub dez
    portc.2 = 1
    gosub dez
    portc.3 = 1
    gosub dez
    portc.4 = 1
    gosub dez
    endif

    dez:
    for i = 1 to 20
    pause 10
    if portb.2 = 1 then
    goto start
    endif
    next i
    I do not see any RETURN ... at the end of your sub ... the only chance to work is PortB.2 = 1 and others = 0 ... 15 chances of "punchthrough"
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    It was my mistake... I forgot to copy return, but it has!
    Sorry but I don't understand what you want to say!

  6. #6
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    there are any way to clear my return adress saved on the stack?

  7. #7
    PaulJC's Avatar
    PaulJC Guest


    Did you find this post helpful? Yes | No

    Default

    What are you trying to achieve with the code, what do you have connected to the ports:

    portb.1 - ?
    portc.1 - ?
    portc.2 - ?
    portc.3 - ?
    portc.4 - ?
    portb.2 - ?

    Cheers

    Paul

Similar Threads

  1. Graphic LCD with PICbasic pro
    By amindzo in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th November 2012, 11:45
  2. Making a menu
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 12th November 2008, 19:54
  3. Problems with RC2 and RC3
    By Christopher4187 in forum General
    Replies: 11
    Last Post: - 29th May 2006, 17:19
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. ds1307 from f877 to f452 not work
    By microkam in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th July 2005, 00:02

Members who have read this thread : 1

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