Jump to content

Functions Palette/Programming/Boolean: Difference between revisions

From LabVIEW Wiki
m Rename category to "Functions Palette"
mNo edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:BooleanPaletteBD.png|thumb|Boolean palette (block diagram)]]
{{LabVIEW Palette Object Information
| palette = Functions Palette/Programming{{!}}Programming palette
| type    = palette
| icon    = Functions Palette - Programming Palette - Boolean.png
}}


The Boolean palette provides constants and functions that can be performed on [[Boolean]], [[Numeric]] and [[Fixed-point]] values.
The '''Boolean''' palette provides constants and functions that can be performed on [[Boolean]], [[Numeric]] and [[Fixed-point]] values.
 
{{TOCright}}
== Logical And ==
{{LabVIEW Palette
 
|image  = Boolean Palette.png
Accepts two Boolean or [[Numeric|numeric]] inputs.
|title  = Boolean palette
 
|parent = Functions Palette/Programming{{!}}Programming palette
'''Boolean''': If provided Boolean values, returns [[File:BooleanTrue2010.png|border|True]] if both inputs are [[File:BooleanTrue2010.png|border|True]], otherwise returns [[File:BooleanFalse2010.png|border|False]].
|1      = And function{{!}}And
 
|2      = Or function{{!}}Or
{| class="wikitable"
|3      = Exclusive Or function{{!}}Exclusive Or
! x
|4      = Not function{{!}}Not
! y
|5      = Compound Arithmetic function{{!}}Compound Arithmetic
! output
|11    = Not And function{{!}}Not And
|-
|12    = Not Or function{{!}}Not Or
| [[File:BooleanFalse2010.png|border|False]]
|13    = Not Exclusive Or function{{!}}Not Exclusive Or
| [[File:BooleanFalse2010.png|border|False]]
|14    = Implies function{{!}}Implies
| [[File:BooleanFalse2010.png|border|False]]
|21    = And Array Elements function{{!}}And Array Elements
|-
|22    = Or Array Elements function{{!}}Or Array Elements
| [[File:BooleanFalse2010.png|border|False]]
|23    = Num to Array function{{!}}Num to Array
| [[File:BooleanTrue2010.png|border|True]]
|24    = Array to Num function{{!}}Array to Num
| [[File:BooleanFalse2010.png|border|False]]
|25    = Bool to (0,1) function{{!}}Bool to (0,1)
|-
|31    = True constant{{!}}True Constant
| [[File:BooleanTrue2010.png|border|True]]
|32    = False constant{{!}}False Constant
| [[File:BooleanFalse2010.png|border|False]]
}}
| [[File:BooleanFalse2010.png|border|False]]
== Functions ==
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
|}
 
'''Numeric''': If provided [[Numeric|numeric]] values, performs a bit-wise AND operation.


{| class="wikitable"
{| class="wikitable"
!
| [[File:Andfunct.png|Logical And|link=And function]]
! Binary
| [[And function|Logical And]]
! Decimal
|-
|-
! x
| [[File:Orfunct.png|Logical Or|link=Or function]]
| <code>10101010</code>
| [[Or function|Logical Or]]
| style="text-align: center;" | 170
|-
|-
! y
| [[File:Xclusvor.png|Exclusive Or|link=Exclusive Or function]]
| <code>11110000</code>
| [[Exclusive Or function|Exclusive Or]]
| style="text-align: center;" | 240
|-
! output
| <code>10100000</code>
| style="text-align: center;" | 160
|}
 
== Logical Or ==
 
Accepts two Boolean or [[Numeric|numeric]] inputs.
 
'''Boolean''': If provided Boolean values, returns [[File:BooleanTrue2010.png|border|True]] if any input is [[File:BooleanTrue2010.png|border|True]], otherwise returns [[File:BooleanFalse2010.png|border|False]].
 
{| class="wikitable"
! x
! y
! output
|-
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:Notfunct.png|Not|link=Not function]]
| [[File:BooleanFalse2010.png|border|False]]
| [[Not function|Not]]
| [[File:BooleanFalse2010.png|border|False]]
|-
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:Comparit.png|Compound Arithmetic|link=Compound Arithmetic function]]
| [[File:BooleanTrue2010.png|border|True]]
| [[Compound Arithmetic function|Compound Arithmetic]]
| [[File:BooleanTrue2010.png|border|True]]
|-
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:Notandfn.png|Not And|link=Not And function]]
| [[File:BooleanFalse2010.png|border|False]]
| [[Not And function|Not And]]
| [[File:BooleanTrue2010.png|border|True]]
|-
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:Notorfun.png|Not Or|link=Not Or function]]
| [[File:BooleanTrue2010.png|border|True]]
| [[Not Or function|Not Or]]
| [[File:BooleanTrue2010.png|border|True]]
|}
 
'''Numeric''': If provided [[Numeric|numeric]] values, performs a bit-wise OR operation.
 
{| class="wikitable"
!
! Binary
! Decimal
|-
|-
! x
| [[File:Notxclor.png|Not Exclusive Or|link=Not Exclusive Or function]]
| <code>10101010</code>
| [[Not Exclusive Or function|Not Exclusive Or]]
| style="text-align: center;" | 170
|-
|-
! y
| [[File:Implies.png|Implies|link=Implies function]]
| <code>11110000</code>
| [[Implies function|Implies]]
| style="text-align: center;" | 240
|-
|-
! output
| [[File:Andarray.png|And Array Elements|link=And Array Elements function]]
| <code>11111010</code>
| [[And Array Elements function|And Array Elements]]
| style="text-align: center;" | 250
|}
 
== Exclusive Or ==
 
Accepts two Boolean or [[Numeric|numeric]] inputs.
 
'''Boolean''': If provided Boolean values, returns [[File:BooleanTrue2010.png|border|True]] if any input is [[File:BooleanTrue2010.png|border|True]] exclusively, otherwise returns [[File:BooleanFalse2010.png|border|False]].
 
{| class="wikitable"
! x
! y
! output
|-
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:Orarray.png|Or Array Elements|link=Or Array Elements function]]
| [[File:BooleanFalse2010.png|border|False]]
| [[Or Array Elements function|Or Array Elements]]
| [[File:BooleanFalse2010.png|border|False]]
|-
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:Numtoboo.png|Num to Array|link=Num to Array function]]
| [[File:BooleanTrue2010.png|border|True]]
| [[Num to Array function|Num to Array]]
| [[File:BooleanTrue2010.png|border|True]]
|-
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:Bootonum.png|Array to Num|link=Array to Num function]]
| [[File:BooleanFalse2010.png|border|False]]
| [[Array to Num function|Array to Num]]
| [[File:BooleanTrue2010.png|border|True]]
|-
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:Bootoone.png|Bool to (0,1)|link=Bool to (0,1) function]]
| [[File:BooleanTrue2010.png|border|True]]
| [[Bool to (0,1) function|Bool to (0,1)]]
| [[File:BooleanFalse2010.png|border|False]]
|}
|}


'''Numeric''': If provided [[Numeric|numeric]] values, performs a bit-wise XOR operation.
== Constants ==


{| class="wikitable"
{| class="wikitable"
!
| [[File:BooleanTrue2010.png|True Constant|link=True constant]]
! Binary
| [[True constant|True Constant]]
! Decimal
|-
|-
! x
| [[File:BooleanFalse2010.png|False Constant|link=False constant]]
| <code>10101010</code>
| [[False constant|False Constant]]
| style="text-align: center;" | 170
|-
! y
| <code>11110000</code>
| style="text-align: center;" | 240
|-
! output
| <code>01011010</code>
| style="text-align: center;" | 90
|}
|}
== Not ==
Returns the inverted value of an Boolean or [[Numeric|numeric]] input.
'''Boolean''':
{| class="wikitable"
! x
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
|}
'''Numeric:'''
{| class="wikitable"
!
! Binary
! Decimal
|-
! x
| <code>10101010</code>
| style="text-align: center;" | 170
|-
! output
| <code>01010101</code>
| style="text-align: center;" | -171
|}
== Compound Arithmetic ==
[[File:CompoundArithmeticChangeMode.png|thumb|Change mode on the Compound Arithmetic function]]
Performs various logical and arithmetic operations on Boolean and numeric values for a dynamic amount of inputs.
'''Available operations''':
* Add
* Multiply
* AND (see [[#Logical_And|Logical And]])
* OR (see [[#Logical_Or|Logical Or]])
* XOR (see [[#Exclusive_Or|Exclusive Or]])
This function is especially useful when doing logical and arithmetic operations on more than two input values.
'''Invert input and output''':
The Compound Arithmetic function allows to invert any of the inputs as well as the output selectively.
[[File:CompoundArithmeticInvertInput.png|frameless|border|Invert input on the Compound Arithmetic function]]
<br clear="all">
== Not And ==
This is the same as [[#Logical_And|Logical And]] but the output is inverted.
'''Boolean''':
{| class="wikitable"
! x
! y
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
|}
'''Numeric'''
{| class="wikitable"
!
! Binary
! Decimal
|-
! x
| <code>10101010</code>
| style="text-align: center;" | 170
|-
! y
| <code>11110000</code>
| style="text-align: center;" | 240
|-
! output
| <code>01011111</code>
| style="text-align: center;" | 95
|}
== Not Or ==
This is the same as [[#Logical_Or|Logical Or]] but the output is inverted.
'''Boolean''':
{| class="wikitable"
! x
! y
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
|}
'''Numeric''':
{| class="wikitable"
!
! Binary
! Decimal
|-
! x
| <code>10101010</code>
| style="text-align: center;" | 170
|-
! y
| <code>11110000</code>
| style="text-align: center;" | 240
|-
! output
| <code>00000101</code>
| style="text-align: center;" | 5
|}
== Not Exclusive Or ==
This is the same as [[#Exclusive_Or|Exclusive Or]] but with inverted output.
'''Boolean''':
{| class="wikitable"
! x
! y
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
|}
'''Numeric''':
{| class="wikitable"
!
! Binary
! Decimal
|-
! x
| <code>10101010</code>
| style="text-align: center;" | 170
|-
! y
| <code>11110000</code>
| style="text-align: center;" | 240
|-
! output
| <code>10100101</code>
| style="text-align: center;" | 165
|}
== Implies ==
Accepts two Boolean or [[Numeric|numeric]] inputs.
'''Boolean''': If provided Boolean values, returns [[File:BooleanFalse2010.png|border|False]] if the first input is [[File:BooleanTrue2010.png|border|True]] and the second input is [[File:BooleanFalse2010.png|border|False]]. Otherwise returns [[File:BooleanTrue2010.png|border|True]].
{| class="wikitable"
! x
! y
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanFalse2010.png|border|False]]
| [[File:BooleanFalse2010.png|border|False]]
|-
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
| [[File:BooleanTrue2010.png|border|True]]
|}
'''Numeric''': If provided [[Numeric|numeric]] values performs a bit-wise implies operation.
{| class="wikitable"
!
! Binary
! Decimal
|-
! x
| <code>10101010</code>
| style="text-align: center;" | 170
|-
! y
| <code>11110000</code>
| style="text-align: center;" | 240
|-
! output
| <code>11110101</code>
| style="text-align: center;" | -11
|}
== And Array Elements ==
Performs the [[#Logical_And|Logical And]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''all''' elements of the array are [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.
== Or Array Elements ==
Performs the [[#Logical_Or|Logical Or]] on an n-dimensional [[Array|array]] of Boolean values. This means, the output is [[File:BooleanTrue2010.png|border|True]] if '''any''' element of the array is [[File:BooleanTrue2010.png|border|True]]. Note that this function works an multi-dimensional arrays, not just one-dimensional.
== Num to Array ==
Converts an [[Integer|integer]] or [[Fixed-point|fixed-point]] number to a Boolean array. The size of the output array depends on the size of the provided number. Note that the least significant bit is at index zero.
== Array to Num ==
Converts a Boolean array to an [[Integer|integer]] or [[Fixed-point|fixed-point]] number with the least significant bit at index zero.
== Bool to (0,1) ==
Returns a Boolean into a 16-bit [[Integer|integer]].
{| class="wikitable"
! x
! output
|-
| [[File:BooleanFalse2010.png|border|False]]
| 0
|-
| [[File:BooleanTrue2010.png|border|True]]
| 1
|}
== True Constant ==
This is the Boolean True constant [[File:BooleanTrue2010.png|border|True]]
== False Constant ==
This is the Boolean False constant [[File:BooleanFalse2010.png|border|False]]


== See also ==
== See also ==
Line 438: Line 88:
* [[Boolean]]
* [[Boolean]]


[[Category:Functions Palette]]
[[Category:Boolean Palette]]
 
[[Category:Boolean Palette]]

Latest revision as of 21:10, 28 September 2020

Object information
Owning palette(s) Programming palette
Type Palette
Requires Basic Development Environment
Icon

The Boolean palette provides constants and functions that can be performed on Boolean, Numeric and Fixed-point values.

Programming paletteAndOrExclusive OrNotCompound ArithmeticNot AndNot OrNot Exclusive OrImpliesAnd Array ElementsOr Array ElementsNum to ArrayArray to NumBool to (0,1)True ConstantFalse Constant
Boolean palette (Click on a function to navigate, or on the arrow to go to parent palette)

Functions

Logical And Logical And
Logical Or Logical Or
Exclusive Or Exclusive Or
Not Not
Compound Arithmetic Compound Arithmetic
Not And Not And
Not Or Not Or
Not Exclusive Or Not Exclusive Or
Implies Implies
And Array Elements And Array Elements
Or Array Elements Or Array Elements
Num to Array Num to Array
Array to Num Array to Num
Bool to (0,1) Bool to (0,1)

Constants

True Constant True Constant
False Constant False Constant

See also