LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with Binary.

Solved!
Go to solution

I need to check if there is an easier way of doing this than the one I'm thinking.

If I have an input of 8 binary bits (i.e. 10111001), I need to check if each individual bits are high "1" or low "0". My initial thought was to start masking individual bits but its becomming messy to start masking individual bits (i'm ending up with 8 "AND's") and a rather big Case Structure.

Would anyone have a better (CLEANER) idea?

 

Thanks

 

Kas

0 Kudos
Message 1 of 3
(2,281 Views)
Solution
Accepted by topic author zerotolerance

Do you want to take a diiferent action for each bit is true? If so, you can simply wire a U8 numeric to a Number to Boolean Array. Wire that to a for loop with a case statement inside. If not, there would be a second case statement inside both the true and false cases and these would be wired to the iteration terminal. You would create cases 0-7. Wiring the outermost case structure to the iteration termial with a true/false inside each of those will do the same thing.

Message 2 of 3
(2,274 Views)

Nice, that should do it. The answer seems so simple, but I would neve thought of this Smiley Happy .

 

Thanks

 

Kas

0 Kudos
Message 3 of 3
(2,264 Views)