gbradley
Lifetime Supporting Member
I would like to turn on a bit with IAI software based on the value of a variable.
I can do it with one CPEQ statement. It works great.
I just need to be able to add some kind of or, or branch in order to be able to also turn off the bit if the variable is another value or two.
It's a simple little program that moves to a position,flashes a light, then moves to the next position, flashes a light etc…
I don't want the light to flash at position 4, so I put a CPEQ 10,4,901, and then on the bton for the light, I put a N901 condition.
I would also like the light to not turn on if the variable is 2, or if the variable is 3, or if the variable is 7.
I just don't know how to branch it so that I can also turn on bit 901 if the value of the variable is 2, or 4, or 3, or 7.
I tried putting the same line of code with an O, but the process halted and I got an error.
,,,LET,10,1,,
,,,WTON,7,,,
,,,TAG,2,,,
,,,CPEQ,10,4,901,
,,,MOVL,*10,,,
,,,CPEQ,10,248,900,
,,,ADD,10,1,,
,N,901,BTON,305,,,
,,,TIMW,0.5,,,
,,,BTOF,305,,,
,N,900,GOTO,2,,,
I can do it with one CPEQ statement. It works great.
I just need to be able to add some kind of or, or branch in order to be able to also turn off the bit if the variable is another value or two.
It's a simple little program that moves to a position,flashes a light, then moves to the next position, flashes a light etc…
I don't want the light to flash at position 4, so I put a CPEQ 10,4,901, and then on the bton for the light, I put a N901 condition.
I would also like the light to not turn on if the variable is 2, or if the variable is 3, or if the variable is 7.
I just don't know how to branch it so that I can also turn on bit 901 if the value of the variable is 2, or 4, or 3, or 7.
I tried putting the same line of code with an O, but the process halted and I got an error.
,,,LET,10,1,,
,,,WTON,7,,,
,,,TAG,2,,,
,,,CPEQ,10,4,901,
,,,MOVL,*10,,,
,,,CPEQ,10,248,900,
,,,ADD,10,1,,
,N,901,BTON,305,,,
,,,TIMW,0.5,,,
,,,BTOF,305,,,
,N,900,GOTO,2,,,