LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean operation

I had an array of 2000 datas, however i only want to extract bit 0 and bit 1 of the data in the array and store them into a new array. the source will be something like the following

(i=0; i++; i<2000)
{
temp = buffer[i];
temp = temp && 0000 0011b;
temp = temp ^ 0000 0011b; /* exclusive or as i want to invert bit0-1*/
data[i] = temp;
}

l had tried using the formula node to do the boolean operation as above, however, i seem to miss out something as the vi prompt me an error. attached is my vi

1. how to carry out "Exclusive OR" on a byte? i wanted to invert bit0 and bit 1 of the data, however i'm not very sure about the command and source code.

2. how do i solve the error prompted by my vi.

thks and best regards

lyn
0 Kudos
Message 1 of 7
(3,421 Views)
Hi, Lyn
I opened your attached VI and I think in the formula node I see one element that you do not specify which is "b" "y=y ^ 00000011b;" you should specify what is b.
Best Regards,
Saw
0 Kudos
Message 2 of 7
(3,421 Views)
You could just take your array (integer) wire it to an AND function, take the output to an Exclusive OR, you don't need to use a formula node at all.

See attached file.
0 Kudos
Message 3 of 7
(3,421 Views)
See attached vi. It contains one solution with the formula node and one without.
0 Kudos
Message 4 of 7
(3,421 Views)
hi saw,
thks for the help, actaually i thought that is the way to define a binary data. so how do i "tell" the formula node that i want to do a "Exclusive OR" to bit 0 and bit 1 of y??

lyn
0 Kudos
Message 5 of 7
(3,421 Views)
thks for the help Ian,

however from the vi that had given me, it shows that you are displaying both the input and ouptut in binary instead of decimal. How did you do that? what did you do to change the display into binary form? i want to change my display into binary too.

thks,lyn
0 Kudos
Message 6 of 7
(3,421 Views)
just right-click on your control/indicater, select Format and in the dialog select Format:Binary
0 Kudos
Message 7 of 7
(3,421 Views)