I am not quite getting my head around the syntax for parameter passing into macros; I don't see why the following code is invalid;
The variable controls will be passed down a shift-register in another routine to actually switch things physically, but I cannot see why I am messing up on parameter passing. I have no trouble coding this with gosubs and so forth, but I would like to try and learn more about parameter passing in macros.
Can someone put me right?
Code:
[color=Navy]#picaxe [/color][color=Black]40x2[/color]
[color=Blue]symbol [/color][color=Purple]controls[/color][color=DarkCyan]=[/color][color=Purple]b0[/color]
[color=Navy]#define [/color][color=Black]redlight [/color][color=Navy]1
#define [/color][color=Black]greenlight [/color][color=Navy]2
#define [/color][color=Black]bluelight [/color][color=Navy]3
#macro [/color][color=Black]light_on [/color][color=Blue]([/color][color=Black]lightcolour[/color][color=Blue])
setbit [/color][color=Purple]controls[/color][color=Black],lightcolour[/color]
[color=Navy]#endmacro
#macro [/color][color=Black]light_off [/color][color=Blue]([/color][color=Black]lightcolour[/color][color=Blue])
clearbit [/color][color=Purple]controls[/color][color=Black],lightcolour[/color]
[color=Navy]#endmacro[/color]
[color=Black]light_on [/color][color=Blue]([/color][color=Black]redlight[/color][color=Blue])[/color]
The variable controls will be passed down a shift-register in another routine to actually switch things physically, but I cannot see why I am messing up on parameter passing. I have no trouble coding this with gosubs and so forth, but I would like to try and learn more about parameter passing in macros.
Can someone put me right?