LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logic operations on a string of bits

Solved!
Go to solution
Highlighted

Hi, I have a very simple question that I cannot seem to figure out.  I would just like to perform logic operations (AND, OR, etc.) on 2 strings of bits that are 24 bits long each, however I cannot find in the functions palette a function that acts as a binary constant.  I only see numeric constant and hex functions.  Can somone please let me know where I can find this.  For example, I would like to AND '111111111111111111111111' & '000000000000000000000000'.    

0 Kudos
Message 1 of 8
(1,381 Views)
Highlighted
Is this a formatted string of 24 characters (0,1) or a 3 byte binary string? If it is a binary string, typecast to u32 and do the bitwise operation.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 8
(1,377 Views)
Highlighted

Thanks for the reply.  Ultimately I will be using type cask when I deploy my application.  However for now I am looking to write logic operation programs to get familiar with data manipulation, and I am wondering where I can find a function to use to input a binary string, such as the "NOT" operation in this example.  They manually input '10000110'

 

http://zone.ni.com/devzone/cda/tut/p/id/3626

 

To answer your question, it will be a binary string consisting of FF FF then my 8-bit data.

0 Kudos
Message 3 of 8
(1,369 Views)
Highlighted
Solution
Accepted by topic author baseball07

Do you know the difference between numeric and string datatypes in LabVIEW? Blue = integer = numeric. Pink = string. In the example you linked to they are using an integer constant where the display format is set to "Binary". The "b" in the constant indicates the radix, which in this case is "binary". Right-click on a numeric constant and you can change its display format. You can select one of the predefined formats or you can specify one by clicking on the "Advanced Editing Mode" option. The allowable formats are defined in the LabVIEW Help. For example

%b = binary

%8b = binary, using minimum field width of 8, padded with spaces (e.g., "    1101")

%08 = binary, using minimum field width of 8, padded with zeros (e.g., "00001101")

Message 4 of 8
(1,358 Views)
Highlighted

Got it, thanks for the help.

0 Kudos
Message 5 of 8
(1,340 Views)
Highlighted

I think that these bitwise operations should work directly on strings too. Thus I wrote up this idea. 🙂 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 8
(1,338 Views)
Highlighted

Boolean operators will work on binary or integer values.  The logical opertors will give you broken lines until it is complety hooked up.

0 Kudos
Message 7 of 8
(1,285 Views)
Highlighted

Convert the string to and integer.

0 Kudos
Message 8 of 8
(1,284 Views)