variables and gosubs???


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer
    I thought that once the program jumps, then it will forget where it was and will return to an unknown place. So that it will never be 100% precise.
    To be even more specific, the GOSUB will put a return address on the top of the "Stack" It will remain there forever (as long as the PIC is not reset) until a RETURN is executed. So, Steve's 2.7894235e+128 GOTOs do nothing to modify the address on the top of the stack. And, no matter when the RETURN is executed, the program will return to that address.

    HTH,
    Steve B
    Last edited by SteveB; - 18th November 2006 at 20:17.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default That's a better explanation indeed !!!

    SteveB....SteveB....SteveB....
    SteveB....SteveB....SteveB....
    Whizzz... Woohoo...
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1198&stc=1&d=116388100 4">
    Attached Images Attached Images  
    Last edited by mister_e; - 18th November 2006 at 20:25.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    So much for my fancy reply. Too slow.

    Got it Sayzer??
    DT

  4. #4
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    So much for my fancy reply. Too slow.
    Ahhhhhhh , I was really looking forward to it. My stab at it was just a down and dirty continuation of what Steve was getting at. We'll let Sayzer and Ryan weigh in on whether it worked for them.

  5. #5
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Steve,
    ROFL, Great picture!

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hehe, Rock and roll, DEVIL!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I have a new teacher now!

    Thanks for this simple and clear explanation SteveB.

    I was expecting DT to come up with really complex explanations. heheh


    --------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    mmm... not complex Sayzer, let's say detailled.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I was going more for ... Cool!

    Well, since we don't need the explanation anymore, I'll leave it at this, since it's already done.

    DT

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1199&stc=1&d=116388436 9">
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    Cool indeed!!! You're going to have to share with us your posting techniques!
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  12. #12
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Holy Gif!

    DT, I can't believe you made it within half an hour!
    What can I say? It is just as you said it was.




    rhino,

    I now see that you were in a different page then I was.

    But, you had your answer and I had mine.


    Thanks to all.

    I enjoyed watching posts coming in and out, too.

    Especially this last post by DT!

    ---------------------------


    Edit: I just realized that it has been two hrs....


    ------------------------------------
    Last edited by sayzer; - 18th November 2006 at 21:24.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  13. #13
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Lightbulb

    Yep... makes sense. After all of your responses and looking at the manual for BranchL...
    Quote Originally Posted by TFM
    ...Index selects one of a list of Labels. Execution resumes at the
    indexed Label
    . For example, if Index is zero, the program jumps to the
    first Label specified in the list, if Index is one, the program jumps to the
    second Label, and so on. If Index is greater than or equal to the
    number of Labels, no action is taken and execution continues with the
    statement following the BRANCHL.
    ....(hence the RETURN)
    I guess seeing that return in Darrel's code was throwing me off, but now it I see why it's in there. It looked to me like a way of nesting subroutines. Both of the Steves explainations of how the return address in the stack works answers one of the questions I didn't even ask.... scary! Thankyou all.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

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