If I correctly understand your remark:
pbpin var byte
pulsout pbpin, w9
I am able to run PWM, Pulsout, Serout, Serin, Output .... statements
on pre-programmed numbers of output pins in one shot?!
Yes and no. You're able to send pulse on a single pre determined PIN for a w9 duration in one shot. Doing some Sub with common called statement or block of statement,l help to reduce the final code size.
Second question about "!!!! usually we use GOSUB with a RETURN.".
I have 7 program each has two submodules rotate left/right and each has
two procedure to calculate W9 value.
In sum about 28 Gosub and 28 Return statements. My guess is here will be real problem with wrong switching.
If you don't have much than 4 nested gosubs, it shouldn't cause any problems. If you have more than 4 nested gosubs, your program may branch somewhere else than you expect.
You can have as much as you want of nested GOTO. As it don't use the STACK... no harm at all.
There's no trick, no magic formula to avoid problems. As in all programming language, you should avoid too many jump here, there elsewhere and have a good program structure. A flowChart could help to figure out the whole thing. Few gosub line placed one after the other is not a too much bad pratice.
Code:
Gosub DoThis
Gosub DoThat
Gosub DoSomethingElse
But the use of nested gosub should be done with care.
Last edited by mister_e; - 11th September 2005 at 00:05.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks