LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary bit test

Solved!
Go to solution

Hi,

 

I need to test each binary bits using following logic equation.

How do I do this?

 

((var & (1<<bit)) != 0)

 

For example

If var = 0111 and bit =2 (start from 0), so third bit of var is 1 and shift by two

are equal, this equation will yield TRUE for third bit.

 

Things I need to accoplish

1. I need to compare every binary bit

2. result should be in corresponing binary bit.

 

Can someone show me how?

 

 

thank you in advance,

 

Do

0 Kudos
Message 1 of 3
(3,013 Views)

Sorry, I put to wrong equation.

Can we try this?

I need to set the bit using following equation

var |= (1<<bit);

0 Kudos
Message 2 of 3
(3,005 Views)
Solution
Accepted by topic author horanyee
In the Numeric >> Data Manipulation palette, there ist he logical shift function to move a bit.  You can also do boolean logic on integers.
0 Kudos
Message 3 of 3
(2,997 Views)