Originally Posted by Darrel Taylor
If there is no typo here, did I misunderstand this statement then ?
-----------------------------
Originally Posted by Darrel Taylor
If there is no typo here, did I misunderstand this statement then ?
-----------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
I'm a little confused as well. I guess as a test, you can put a statement under the branch instruction to flash an LED or something to see what happens. The way I read it is it will return back to the while loop because there is nothing else in the SubSwitcher routine to execute after the branch statement, just another return back to the while loop.
Wisdom is knowing what path to take next... Integrity is taking it.
Ryan Miller
Ok guys, sit back, take a breath, give me a little while to come up with a better answer.
All will be revealed. Or further confused. We'll see.
DT
I'll try something...
Nothing hard here right? after the Return... you return to Label1 ... right?Code:StartPoint: Gosub Somewhere Label1: Pause 100 Goto Start Somewhere: Pause 1 Return
Now...
Same thing happen here...Code:StartPoint: Gosub Somewhere Label1: Pause 100 Goto Start Somewhere: Goto SomewhereElse z: goto z SomewhereElse: Return
This said...
Where the Return of Routine0 leads you?... to ReturnPointCode:Start: for routines=0 to 3 StartPoint: gosub subselect ReturnPoint: pause 200 next goto start SubSelect: branchl routines, [Routine0, Routine1, Routine2, Routine3] Routine0: return
I know i'm a pretty bad teacher...![]()
Last edited by mister_e; - 18th November 2006 at 20:02.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
and I am a good student.
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.
---------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Gosub and Return are good friends...
As long as you have a GOSUB... you can insert 2789423564875634275624365 432956345634564326586324957243657 234596243652 43656243756243654 356437856 46582436587243657 26435726435 2436 (+/- 1) goto in-between. And when you'll use Return, it will return just under the GOSUB.
Last edited by mister_e; - 18th November 2006 at 20:11.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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.Originally Posted by sayzer
HTH,
Steve B
Last edited by SteveB; - 18th November 2006 at 20:17.
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">
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.
Bookmarks