|
Unfortunately, the PBASIC tokenizer will not accept things like myVar=(p1_y>127), etc with the exception of predicates in IF statements. Ie, you can do IF myVar=(p1_y>127) THEN doStuff, but the = will be interpreted as equality, not assignment. Someone please correct me if I'm wrong on this...
As for the integer math, that only works assuming that bytevarX will never be bigger than the value you are testing for. If it could be, then the behavior is rather sporadic. For example. bitVarY=5/10 will assign the value 0 to bitVarY since the lowest-order bit of 5/10 (= 10b) is zero, wheras 5/15 (=11b) will assign it the value 1.
You can, however, express what you want on one line:
IF (bytevarX = 254) THEN bitvarY = 1 ELSE bitvarY = 0
--Rob
|