Symbol assignment question

reywas

Member
Is there a way to assign more than one input to a symbol, something like "symbol SW1_SW2 = pinsC & $03" ?

Currently my code is b0 = pinsC & $03
 
Last edited:

pxgator

Senior Member
You could do this with a macro:

#MACRO SW1_SW2()
b0 = pinsC & $03
#ENDMACRO

Then in your code just use SW1_SW2 this results in the same as your current code...b0 = pinsC & $03
 
Last edited:

pxgator

Senior Member
No, the macro does not return a value it justs updates b0.
So you could use it like this:

SW1_SW2
If b0 = 1 then
code
elseif b0 = 2 then
code
endif

You could also include the code in the macro:

#MACRO SW1_SW2()
b0 = pinsC & $03
If b0 = 1 then
code
elseif b0 = 2 then
code
endif
#ENDMACRO

Then just one simple line does it all :)

SW1_SW2
 
Last edited:

pxgator

Senior Member
This will also work: #DEFINE SW1_SW2 b0 = pinsC & $03

A MACRO is simply a multi-line DEFINE statement.
Good luck with your coding.

Cheers to All
 
Top