
Originally Posted by
Darrel Taylor
It is equivelent to ...
Code:
IF LoopLED(x) < OnTime(x) THEN
GPIO.0(x) = 1
ELSE
GPIO.0(x) = 0
ENDIF
What you would like to do is a direct assignment of a True/False comparison to a variable.
Code:
GPIO.0(x) = LoopLED(x) < OnTime(x)
But
LoopLED(x) < OnTime(x) is a "Logical" expression that can't be assigned to a BIT variable.
The bitwise NOT operator (!) can convert the logical expression to a bitwise expression that can be assigned to a BIT variable.
A single ! will invert the result, so a second ! is used to invert it back.
Somtimes you want the result inverted, and you can use a single !.
Other times you might invert the logic of the comparison, use a single !, which gives you a non-inverted result.
Could the comparison have been reversed, like this?
Code:
GPIO.0(x) = !(LoopLED(x) >= OnTime(x))
Also, is the GPIO.0(x) a valid PBP construct? It's not very intuitive (to me). I would think that GPIO.0 is the GP0 pin and then the (x) looks really alien...
Bookmarks