Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
5 ratings:
 3.79 out of 5   

How do I use the Compound Arithmetic function in LabVIEW?

Primary Software: LabVIEW Development Systems>>LabVIEW Base Development System
Primary Software Version: 2015
Primary Software Fixed Version: N/A
Secondary Software: N/A

I am using the Compound Arithmetic function to perform an XOR operation on multiple inputs in LabVIEW. This function seems to act differently than expected. What method does the Compound Arithmetic function use for calculating its result?

The Compound Arithmetic function performs arithmetic on multiple numeric, array, cluster, or Boolean inputs. You can select the math operation (Add, Multiply, AND, OR, or XOR) by right-clicking the function and selecting Change Mode from the shortcut menu. The default mode depends on the palette from which you drop this function. If you drop this function from the Numeric palette, the default mode is Add. When you drop this function from the Boolean palette, the default mode is OR.

When you use the Compound Arithmetic function to perform an operation on 3 or more values, it performs the operation on the first pair of inputs, then performs the operation on that result and the next input, and so on until all inputs have been processed. 

With the XOR operation, if both inputs are TRUE or both inputs are FALSE, the function returns FALSE. Otherwise, it returns TRUE. This operation is not defined for more than 2 inputs. Instead, XOR gates with 3 or more inputs act as Parity Generators, which return a TRUE input if there are an odd number of TRUE inputs, and FALSE if there are an even number of TRUE inputs.

Below are two VI snippets showing different methods that function exactly the same. The first uses the Compound Arithmetic VI, and the second uses cascading XOR VIs.

Using the Compound Arithmetic VI (XOR)

Using cascading XOR VIs

Related Links:
LabVIEW Help: Exclusive OR Function
LabVIEW Help: Compound Arithmetic Function



Report Date: 12/06/2005
Last Updated: 08/15/2017
Document ID: 3S5GFN6S

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit