Professional Documents
Culture Documents
JCB30304 Data Acquisition System: Chapter 2: Basic Programming Miss Nur Fazira Haris
JCB30304 Data Acquisition System: Chapter 2: Basic Programming Miss Nur Fazira Haris
JCB30304
DATA ACQUISITION SYSTEM
CHAPTER 2 : BASIC PROGRAMMING
MISS NUR FAZIRA HARIS
CHAPTER 2
Boolean
Array
String
Enum
Booleans
LabVIEW stores Boolean data as 8-bit values. A Boolean can be used in
LabVIEW to represent a 0 or 1, or a TRUE or FALSE.
If the 8-bit value is zero, the Boolean value is FALSE. Any nonzero value
represents TRUE.
Common applications for Boolean data include representing digital data
and serving as a front panel control that acts as a switch that has a
mechanical action often used to control an execution structure such as a
Case structure.
A Boolean control is typically used as the conditional statement to exit a
While Loop. In LabVIEW, the color green represents Boolean data.
Boolean Function
Comparison Functions
Example 5
LabVIEW provides a Select function that will perform one of two
actions depending on Boolean value. The function is available in either
of two groups on the Functions
Palette:
Functions Palette / Express Group / Arithmetic & Comparison Group /
Express Comparison Group / Select
Functions Palette / Programming Group / Comparison Group / Select
For practice using the Select function, create a VI that will display
either the natural logarithm of a value, or the base 10 logarithm
depending on the position of a toggle switch.
Solution
Array Shell
Drag and drop the empty Array on the Front Panel, next you find a
Control or Indicator (Numeric, String, Boolean, etc,) and drag it into
the empty Array.
Arrays
You can create an Array of (almost)any kind of
Control or Indicator.
Front panel showing an empty array shell (A) and three populated array shells (B)
Arrays
2D or multidimensional Array?
Just drag the mouse in the
Index display to the left and
increase the dimension.
All these functions are basic (but very useful) array functions
you will probably be using in all your applications and Vis.
Polymorphism
All LabVIEW arithmetic functions are polymorphic.
This means that the inputs to these functions can be different data
structures such as scalar values and arrays.
By definition polymorphism is said to be the ability of a numeric
function to adjust to input data of different data structures.
For example, the Add function can be used in the following ways.
1. Scalar + Scalar = Scalar addition.
2. Scalar + Array = The scalar is added to each element of array.
3. Array + Array = Each element of one array is added to the corresponding
element of other array.
Polymorphism
(a) Adding two scalar values