need help parsing out a long.. probably simple
laser-vector
Posts: 118
hi!
im building an application with labview to control a few things in my propeller.
labview sends out a string of bytes that the propeller interprets and compiles into a long.
in this example each bit after the 8 most significant bits represents a boolean condition, and the 8 msb's represent a number... so
databyte = 43
if button one is true,
LONG1 = %00101011_00000000_00000000_00000010
databyte = 46
if button one and two are true,
LONG1 = %00101110_00000000_00000000_00000110
databyte = 0
if button nineteen is true,
LONG1 = %00000000_00001000_00000000_00000000
so now i need to figure out a way to sample LONG1 to see the state of these bits and retrieve the value of the 8 msb's.
any ideas???
im building an application with labview to control a few things in my propeller.
labview sends out a string of bytes that the propeller interprets and compiles into a long.
in this example each bit after the 8 most significant bits represents a boolean condition, and the 8 msb's represent a number... so
databyte = 43
if button one is true,
LONG1 = %00101011_00000000_00000000_00000010
databyte = 46
if button one and two are true,
LONG1 = %00101110_00000000_00000000_00000110
databyte = 0
if button nineteen is true,
LONG1 = %00000000_00001000_00000000_00000000
so now i need to figure out a way to sample LONG1 to see the state of these bits and retrieve the value of the 8 msb's.
any ideas???
Comments
The individual status bits can be tested like so:
-Phil
value := Long1.byte[0] 'lsb
value := Long1.byte[1]
value := Long1.byte[2]
value := Long1.byte[3] 'msb