number of gosub's

davidwf

Senior Member
I ran the syntax checker and was advised that I had exceeded the number of permitted gosub commands (PIC18X) .... report said that max = 16....but when I counted them I only had 16 ! :confused:
Removing one (wordcount now = 15) appears to have cured the problem

Any ideas ?
 

moxhamj

New Member
If you go to View/Options you can change it to 256. From time to time it will change back to 16 (eg if you download a different program to an 08/08M), but just change it back to 256.

I tend to use lots of gosubs as the code in the main routine ends up simpler to understand. Technically, you don't need a gosub for a routine that is only called once, as you could just paste that code into the main routine. But it is easier to understand with gosubs - especially if you document which variables are used and altered by that gosub.
 

hippy

Technical Support
Staff member
On any PICAXE which supports interrupts you have one less GOSUB statement available than it says you're allowed because it executes a hidden GOSUB when the interrupt occurs.

I'll agree with anyone who says it's confusing.
 

SD2100

New Member
You can use the GOSUB directive in your program so it changes to what you want without having to change it in the options.

Code:
#gosubs 256
 
Top