gbradley Posted January 28, 2014 Report Posted January 28, 2014 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,,,
gbradley Posted January 28, 2014 Author Report Posted January 28, 2014 I figured it out. I put a N, 901 before testing the other values, that way it would ignore if the bit had already been turned on. ,,,CPEQ,10,2,901, ,N,901,CPEQ,10,3,901, ,N,901,CPEQ,10,4,901, ,N,901,CPEQ,10,7,901, It may not be the most eloquent solution, but it works.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now