Can't Get the Lights On
Xetar
Posts: 10
I'm trying to get 3 LED's to represet the first 3 bits in a variable (BYTE lclState). The variable will contain a number from 0 to 5. So far nothing I've tried has worked. I've either got all lights on or nothing.
This code here turns all the lights on no matter what.
outa[12] := (lclState and %001) <> 0
outa[13] := (lclState and %010) <> 0
outa[14] := (lclState and %100) <> 0
This code here turns all the lights on no matter what.
outa[12] := (lclState and %001) <> 0
outa[13] := (lclState and %010) <> 0
outa[14] := (lclState and %100) <> 0
Comments
outa[12..14] := lclState
Try replacing "and" with "&". You want the bitwise and operator.