Hello,
You can do something like this.
Say the variable is a byte called bytevar you can check the state of bit 0 by doing this inside a decision icon.
if you want to check bit 1 then it becomes
bit2 = 0x04
bit3 = 0x08
bit4 = 0x10
bit5 = 0x20
bit6 = 0x40
bit7 = 0x80
or you can do it pragmatically using a second variable bitvar to store the bit location 0 to 7.
If you need to store the value of the bit rather then simply acting on it then you can do this in a calculation icon. Note that this will simply copy the bit value across.
Code: Select all
bitstate = bytevar & (0x01 << bitvar)
If instead you need the bit value to be equal to 0 or 1 then you can instead do this.
Code: Select all
bitstate = (bytevar >> bitvar) & 0x01