LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there "bit operator" in LV?

IN VC or VB, there is the "bit operator", how about in LV?
If not, are there methods to do the same thing?
0 Kudos
Message 1 of 7
(3,095 Views)
What exactly do you mean with "bit-operator"?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 7
(3,091 Views)
Hi, becktho. In a binary file, every byte is composed of 8 bits, for example:10110110. I want to do the following operation
1*1+0*2+1*3+1*4+0*5+1*6+1*7+0*8. I don't know how to do thisSmiley Sad
0 Kudos
Message 3 of 7
(3,089 Views)
You could use the shift operator (palette > Numeric > Data Manipulation) or you could also use the logical functions (AND, OR, XOR, ...) with numbers.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 7
(3,078 Views)

All of LV's logical operators will operate on numeric values.

Just wire you numbers to the input of the appropriate gate (And, or, X-Or,...) and the returned value will be the bit-wise result.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 7
(3,077 Views)
You DO realise that 1^8 is equivalent to 1^4 which is equivalent to 1, don't you.  So 011101101 will result in 5, which is basically the sum of all the 1s in the byte.  Is this what you want?  Do you mean 1x2^0 + 0x2^1 + 1x2^3 + 1x2^4 and so on.....?

You don't mean simply casting the 8 bits to an U8 number, do you?

Do you have the 8 bits as 8 bits, or as 8 numbers, each set to either 1 or 0.  What data format do your numbers have?

If they're U8, you can use the function "Boolean array to number" to be found on the Boolean palette.

If they're bits, well you're basically already done.

Hope this helps

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 6 of 7
(3,078 Views)
Thanks, your guys. Problem solved. I use "number to boolean array" and " boolean to (0,1)"
0 Kudos
Message 7 of 7
(3,066 Views)