From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logic operations on a string of bits

Solved!
Go to solution

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
(3,103 Views)
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.
Message 2 of 8
(3,099 Views)

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
(3,091 Views)
Solution
Accepted by 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
(3,080 Views)

Got it, thanks for the help.

0 Kudos
Message 5 of 8
(3,062 Views)

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

0 Kudos
Message 6 of 8
(3,060 Views)

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
(3,007 Views)

Convert the string to and integer.

0 Kudos
Message 8 of 8
(3,006 Views)