LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bit masking

I have a DAQ board with two ports. I need to mask a port(8-bit) so that I can use the individual bits, I tried decimate 1D array but the output is still an array.

I'd like to be able to AND the port with my mask and be left for a boolean value for the desired bit.

Very confused with Labview... ;-(

Ron
0 Kudos
Message 1 of 3
(4,136 Views)
Rhayes,

The function you need to use is Boolean Array to number. You can make your mask using an array of booleans and then convert that to a number. The number will then act as your mask.

In addition you can use the boolean functions (And, Or, Not, etc) on the array of booleans and it will bit wise do the boolean operation.

You can look at some of the digital DAQ examples (Dig Multi-line Direction (E).vi) to see how this can be done.

Evan
0 Kudos
Message 2 of 3
(4,136 Views)
>I'd like to be able to AND the port with my mask and be left for a boolean value for the desired bit.

I may be wrong but it is my understanding that you have succeeded in getting a boolean array from your port. If so, and since you want to use the actual bit value of a known bit position, use the Index Array function (All Functions >> Array palette) and wire the bit position number to the index terminal. The output will be a single element with the value at that bit position.

I am fairly new to masking operations but my understanding is that masking "hides" the values of masked bits which is used in case you are not interested in what their values are. I stand corrected if I am wrong.

Good luck.
0 Kudos
Message 3 of 3
(4,136 Views)