Why is this giving me an error?

hippy

Ex-Staff (retired)
So what exactly is the error you get ?

Is it "Only 16 gosub commands allowed!" by any chance ?

What does the error message suggest is the cause of the problem ?
 
Last edited:

hippy

Ex-Staff (retired)
I'm surprised there's no explanatory message with the error, attached is what I get. Perhaps you need to upgrade to the latest version of the Programming Editor ?

To set whether the chip should accept 16 or 256 Gosubs you need to alter the setting under View->Options. Using 16 Gosubs generates smaller programs but obviously limits the number of subroutines allowed.

You can replace your Gosubs with Goto ( and replace the Returns as well ). You can also consider Case and even Branch/On-Goto which would be even more efficient. For maximum efficiency you can use LookUps which can determine from temp2 what pins should be set or cleared.
 

Attachments

Last edited:

wob_b

New Member
Thanks hippy!
yeah Ive used cases, made it so much easier to read.

Are you saying that its not a requirement of the chip as to wither you use 16 or 256? but just whatever u want? surly its always preferable to use 256... or does it take up every room or something?

wob_b
 

hippy

Ex-Staff (retired)
Yes, you get to choose whether you want 16 or 256 subroutines. Most PICAXE's are limited to just 16, others only allow 256. The 18X and 28X allow either ( original versions only allowed on 16 ). With just 16 Gosubs only a 4-bit number is needed to identify each Gosub whereas with 256 that needs to be an 8-bit number so it makes the program code slightly larger and it is slightly slower to execute a Gosub.
 
Top