labVIEW Lab Manual
labVIEW Lab Manual
THEORY:
• BLOCK DIAGRAM WINDOW- The block diagrams accompany the program for the front
panel. Front panel objects appear as terminals on the block diagram and the components
wired together. After the front panel is built, codes are added using graphical representations
of functions in the block diagram to control the front panel objects. The block diagram
contains the graphical source code composed of nodes, terminals, and wires.
• TOOL PALETTE- Tool palette is available on both the front panel and the block diagram.
We can create, modify, and debug VIs using the tools located on the floating Tools palette.
These tools are used to modify and program/design front panel and block diagram window
according to the task to be performed.
1
Fig. 1.1
• CONTROL PALETTE- The Controls palette is available only on the front panel. The
Controls palette contains the controls and indicators which you can use to create the front
panel. The Controls palette can be accessed from the front panel by selecting View»Controls
Palette or by right-clicking an open space on the front panel window to display the Controls
palette. The Controls palettes contain subpalettes of objects which you can use to create a VI.
When you click a subpalette icon, the entire palette changes to the subpalette you selected. To
use an object on the palettes, click the object and place it on the front panel.
Fig. 1.2
• FUNCTION PALETTE- The Functions palette contains the sub VIs, functions, and
constants that are available only on the block diagram. It can be access from the block
diagram by selecting View»FunctionsPaletteThe VIs and functions located on the Functions
palette depend on the palette view currently selected. The VIs and functions are located on
subpalettes based on the types of VIs and functions.
2
Fig.1.3
• FRONT PANEL CONTROLS AND INDICATORS-We can build the front panel with
controls and indicators, which are the interactive input and output terminals of the VI,
respectively. Controls are knobs, push buttons, dials and other input devices. Indicators are
graphs, LEDs and other displays. Controls simulate instrument input devices and supply data
to the block diagram of the VI. Indicators simulate instrument output devices and display data
the block diagram acquires or generates.
TERMINALS: Terminals are entry and exit ports that exchange information between the
front panel and block diagram. Terminals are analogous to parameters and constants in text-
based programming languages. Types of terminals include control or indicator terminals and
node terminals. Control and indicator terminals belong to front panel controls and indicators.
NODES: Nodes are objects on the block diagram that have inputs and/or outputs and perform
operations when a VI runs. They are analogous to statements, operators, functions, and
subroutines in text-based programming languages. Nodes can be functions, subVIs or
3
structures. Structures are process control elements, such as Case structures, For loops, or
While loops. The Add and Subtract functions in the previous figure are function nodes.
SUBVIs: SubVIs are VIs that you build to use inside of another VI or that you access on the
Functions palette. Any VI has the potential to be used as a subVI. When you double-click a
subVI on the block diagram, its front panel and block diagram appear.
WIRES: Each wire has a single data source, but you can wire it to many VIs and functions
that read the data. Wires are different colors, styles and thicknesses, depending on their data
types. A broken wire appears as a dashed black line with a red X in the middle Broken wires
occur for a variety of reasons, such as when you try to wire two objects with incompatible
data types.
NUMERIC CONTROL: numeric control in LabVIEW is one of the functions in function palette
which is used to perform arithmetic/numeric operations. It contain many functions like addition,
subtraction, divide, square and many other as shown in figure below:
4
EXERCISE 1
1. Z = X+Y
Fig.1.5
2.
Fig.1.6
5
3.
Fig.1.7
4.
Fig 1.8
6
Exercise 2. Draw a VI for gauge meter.
Fig: 1.9
Exercise 3 Implement a Virtual Instrument for conversion of temperature from Celsius to Fahrenheit
7
EXPERIMENT 2
THEORY:
BOOLEAN CONTROL: Boolean is function from function palette which has functions like AND,
OR, NOT, etc. as shown in the given figure.
Booleans have only two possible values: True or False and are indicated by green data wires.
Fig 2.1
8
Palette
Description
Object
Computes the logical AND of the inputs. Both inputs must be Boolean values,
And numeric values, or error clusters. If both inputs are TRUE, the function returns
TRUE. Otherwise, it returns FALSE.
Returns TRUE if all the elements in Boolean array are TRUE or if Boolean
And Array array is empty. Otherwise, the function returns FALSE. This function accepts
Elements an array of any size but returns only a single value based on all values in
Boolean array.
Boolean Converts a Boolean array to an integer or a fixed-point number by
Array To interpreting the array as the binary representation of the number. The first
Number element of the array corresponds to the least significant bit in the number.
Boolean To Converts a Boolean FALSE or TRUE value to a 16-bit integer with a value of
(0,1) 0 or 1, respectively.
Performs arithmetic on one or more numeric, array, cluster, or Boolean inputs.
To select the operation (Add, Multiply, AND, OR, or XOR), right-click the
Compound
function and select Change Mode from the shortcut menu. When you select
Arithmetic
this function from the Numeric palette, the default mode is Add. When you
select this function from the Boolean palette, the default mode is OR.
Computes the logical exclusive or (XOR) of the inputs. Both inputs must be
Boolean values, numeric values, or error clusters. If both inputs are TRUE or
Exclusive Or
both inputs are FALSE, the function returns FALSE. Otherwise, it returns
TRUE.
False
Use this constant to provide a value of FALSE to the block diagram.
Constant
Negates x and then computes the logical OR of y and the negated x. Both
Implies inputs must be Boolean values, numeric values, or error clusters. If x is TRUE
and y is FALSE, the function returns FALSE. Otherwise, it returns TRUE.
Computes the logical negation of the input. If x is FALSE, the function returns
Not
TRUE. If x is TRUE, the function returns FALSE.
Computes the logical NAND of the inputs. Both inputs must be Boolean
Not And values, numeric values, or error clusters. If both inputs are TRUE, the function
returns FALSE. Otherwise, it returns TRUE.
Computes the logical negation of the logical exclusive or (XOR) of the inputs.
Not Exclusive Both inputs must be Boolean values, numeric values, or error clusters. If both
Or inputs are TRUE or both inputs are FALSE, the function returns TRUE.
Otherwise, it returns FALSE.
Computes the logical NOR of the inputs. Both inputs must be Boolean values,
Not Or numeric values, or error clusters. If both inputs are FALSE, the function
returns TRUE. Otherwise, it returns FALSE.
Converts an integer or fixed-point number to a Boolean array. If you wire an
integer to number, Boolean array returns an array of 8, 16, 32, or 64
Number to elements, depending on the number of bits in the integer. If you wire a fixed-
Boolean point number to number, the size of the array that Boolean array returns
Array equals the word length of the fixed-point number. The 0th element of the array
corresponds to the least significant bit of the two's complement representation
of the integer.
Computes the logical OR of the inputs. Both inputs must be Boolean values,
Or numeric values, or error clusters. If both inputs are FALSE, the function
returns FALSE. Otherwise, it returns TRUE.
9
Exercise 1. Design a VI for finding if the number is even or odd.
Fig 2.1
10
Fig 2.2
Fig 2.3
11
Exercise 6. Draw a VI for 4x1 MUX
Fig 2.4
12
EXPERIMENT 3
THEORY:
Result string contains the input string with one or all occurrences of search string replaced with
replace string. If replace string is empty, result string contains input string with search string deleted.
String Functions:
Fig 3.1
13
EXERCISE 1
Fig 3.2
EXERCISE 2. Design a VI to display your name and perform the following operation on strings-
14
Fig: Block Diagram
15
Fig: 3.3
16
EXPERIMENT 4
THEORY:
Sub VI
Within LabVIEW, program modularity means creating smaller sections of code known as subVIs.
SubVIs are the same as VIs. They contain front panels and block diagrams, but you call them from
within a VI. A subVI is similar to a subroutine in text-based programming languages.
When subVI is created and when it is used, an icon within block diagram that represents the subVI.
17
EXERCISE:
18
3. Design a VI for 4bit adder using sub VI.
19
4. Design a VI for compare two input data.
Fig 4.4
20
EXPERIMENT 5
AIM: Introduction and implementation of loops and arrays using Lab View.
THEORY
‘FOR’ LOOP:
Executes its sub diagram n times, where n is the value wired to the count (N) terminal. The iteration
(i) terminal provides the current loop iteration count, which ranges from 0 to n-1.
Loop tunnels allow you to pass data through the For Loop. You can change the tunnel mode to
handle data that passes through the For Loop in different ways, as listed in the following table.
21
‘WHILE’ LOOP:
Repeats the code within its sub diagram until a specific condition occurs. A While Loop always
executes at least one time.
1. Sub diagram—Contains code that the While Loop executes once per iteration.
2. Iteration Terminal (i)—Provides the current loop iteration count. The loop count
always starts at zero for the first iteration. If the iteration count exceeds
2,147,483,647, or 231-1, the iteration terminal remains at 2,147,483,647 for all
further iterations. If you need to keep count of more than 2,147,483,647 iterations,
you can use shift registers with a greater integer range.
Arrays: Arrays group data elements of the same type. An array consists of elements and
dimensions. Elements are the data that make up the array; a dimension is the length, height
or depth of an array. An array can have one or more dimensions.
An array uses an index so you can readily access any particular element. The index is zero
based, which means it is in the range 0 to n-1. where n is the number of elements in the
array.
Array Functions:
1.Array Size:
The Array Size Function returns the number of elements in an array it is wired to.
22
2. Initialize Array:
Initialize Array crates an array of dimension size elements containing the element value.
3 Build Array
4, Array Subset
Array Subset returns a portion of an array starting at index and containing length elements.
23
EXERCISE 1 Design a VI to print Fibonacci series.
Fig 5.1
Fig 5.2
EXERCISE 3.A strain gauge is used to control the operation of motor. Motor should run in
clockwise direction if input strain is greater than 1 psi and clockwise is less than 0.5 psi and
stops if strain is in between 1psi and 0.5 psi.
24
Fig 5.3
Fig 5.4
25
Fig. 5.5
26
Fig 5.6
27
EXPERIMENT 6
THEORY:
Ring controls: are numeric objects that associate numeric values with strings or pictures. Ring
controls appear as pull-down menus that users can cycle through to make selections.
Ring controls are useful for selecting mutually exclusive items, such as trigger modes. For example,
use a ring control for users to select from continuous, single, and external triggering.
Right-click a ring control and select Edit Items from the shortcut menu to add items to the ring
control list in the control. The order of the items in the Edit Items page of the Ring Properties
dialog box determines the order of the items in the control. You also can configure the ringcontrol so
users can enter numeric values not already associated with any entries in the list of items defined for
the control.
CASE STRUCTURE: A case structure has two or more sub diagrams or cases. Only one sub
diagram is visible at a time. An input value determines which sub diagram executes. The case
structure is similar to switch or if. then. Else statements in text based programming languages. The
case selector label at the top of the case structure contains the name of the selector value that
corresponds to the case in the center and decrement and increment arrows on each side. Wire an
input value, or selector, to the selector terminal to determine which case executes.
Fig 6.1
28
Fig 6.2
Exercise 2. Design a VI to convert m to km with help of ring control and case structure.
Fig 6.3
Exercise 3. Draw a VI to find if the number is even or odd and display even in output if even and
odd if output is odd.
Fig 6.4
29
EXPERIMENT 7
AIM: Introduction to NI ELVIS (Educational Laboratory Virtual Instrumentation Suite)
THEORY: The purpose of this laboratory is to provide an introduction to the NI Elvis design and
prototyping environment. Basic operations provided by Elvis like digital Multimeter, function
generator, oscilloscope and bode analyzer are explained. Passive RC high pass and second order low
pass filter circuits are characterized using NI Elvis.
30
Signal Name Reference Direction Description
31
Signal Name Reference Direction Description
The National Instruments Educational Laboratory Virtual Instrumentation Suite (NI ELVIS) is a
LabVIEW and computer based design and prototyping environment. NI ELVIS consists of a custom-
designed bench top workstation, a prototyping board, a multifunction data acquisition device, and
LabVIEW based virtual instruments. This combination provides an integrated, modular
instrumentation platform that has comparable functionality to the DMM, Oscilloscope, Function
Generator, and Power Supply found on the laboratory workbench.
Fig 7.4
32
EXPERIMENT 8
THEORY:
Analog Input (AI) : There are two analog input channels on NI myDAQ. These channels can be
configured either as general-purpose high-impedance differential voltage input or audio input. The
analog inputs are multiplexed, meaning a single analog-to-digital converter (ADC) is used to sample
both channels. In general-purpose mode, you can measure up to ±10 V signals. In audio mode, the
two channels represent left and right stereo line level inputs. Analog inputs can be measured at up to
200 kS/s per channel, so they are useful for waveform acquisition. Analog inputs are used in the NI
ELVISmx Oscilloscope, Dynamic Signal Analyzer, and Bode Analyzer instruments.
Analog Output (AO) : There are two analog output channels on NI my DAQ. These channels can
be configured as either general-purpose voltage output or audio output. Both channels have a
dedicated digital-to-analog converter (DAC), so they can update simultaneously. In general-purpose
mode, you can generate up to ±10 V signals. In audio mode, the two channels represent left and right
stereo outputs.
Fig 8.1
33
Fig 8.2
Fig 8.4
34
EXPERIMENT 9
THEORY:
Digital Input/output (DIO): There are eight DIO lines on NI myDAQ. Each line is a Programmable
Function Interface (PFI), meaning that it can be configured as a general-purpose software-timed
digital input or output, or it can act as a special function input or output for a digital counter. Refer to
Digital I/O (DIO) and Counters/Timers section for more information about the counter on NI
myDAQ.
Fig 9.1
35
EXPERIMENT 10
Flat Sequence Structure: Consists of one or more sub diagrams, or frames, that execute
sequentially. Use the Flat Sequence structure to ensure that a sub diagram executes before or after
another sub diagram.
Data flow for the Flat Sequence structure differs from data flow for other structures. Frames in a Flat
Sequence structure execute from left to right and when all data values wired to a frame are available.
The data leaves each frame as the frame finishes executing. This means the input of one frame can
depend on the output of another frame.
When you add or delete frames in a Flat Sequence structure, the structure resizes automatically.
You attempt to control the data flow of your VI by establishing data dependency or using flow-
through parameters.
Fig 10.1
36
EXPERIMENT 11
Theory: -
Lab view includes a set of VI’s that let you configure, acquire data from and send data to DAQ
devices, often one device can perform a variety of functions: analog to digital conversion, digital to
analog conversions and digital I/O.
Fig 11.1
Lab VIEW File I/O When conducting experiments with equipment it is important to record data for
analysis and calibration of instruments. Lab VIEW has several functions for writing data to files –
both continuous writing (online, while the VI runs) and batch (offline) writing. Lab VIEW has also
functions for reading data in such log-files. These functions are available on the Programming > File
I/O palette. File I/O operations pass data to and from files. Use the File I/O VIs and functions located
on the Programming » File I/O palette to handle all aspects of file I/O,
Web publishing tools are applications that are used to design and build websites for either
the Internet or an Intranet. They range from simple text editors that can generate web application
code to highly sophisticated and feature-rich web authoring packages.
37
Some web publishing tools must be installed on a workstation. Others are server-based and are
accessed via a web-interface. Web Publishing Tools are also called web authoring tools.
This tutorial provides an overview of current web publishing application software. It is intended for
individuals and small business owners who wish to establish a new website or want to upgrade an
existing site. In general, the goal is to create websites that are attractive, functional and
maintainable.
Fig 11.2
Fig 11.3
38
Fig 11.3
Fig 11.4
39
Fig 11.5
40
41