Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Department of Electrical Engineering

Control Systems (ELE-321), Spring 2024

Lab Handout #1: Introduction to LabVIEW


Instructor: Dr. Abdul Baseer Buriro

Name: _________________________
CMS ID: _______________________

Page 1 of 6
Rubrics for Lab Reports
PLO-5, Psychomotor-3, “Demonstrate the working of LabVIEW programming”
S. Criteria Beginning Developing Competent Outstanding
No. (40%) (60%) (80%) (100 %)

1 Task The code doesn’t The code is having The code works The code works
Performed work or is issues and is not perfectly per the perfectly well per the
(50%) incomplete. per the requirements. The requirements. The
Submission of requirements. Poor front panel design front panel is well
the code file front panel design and code designed and the code
(VI). and the code is readability require is well readable.
hard to read. improvements.

2 Performed Consistently Needed help for Needed minor help. Performed without
Independently needed help to most of the tasks. help.
(20%) perform the task.
During the lab
session.

2. Report Figures, tables, Figures, graphs, The figures, tables, Figures, tables, and/or
Structure and/or graphs and/or tables were and/or graphs were graphs were nicely
(30%) were poorly fine but contained good looking and presented with
constructed and errors. The overall the overall report complete captions and
contained errors. format was broken format was good the format was
The overall and contained but still needs some amazing.
format was out of grammatical and improvements.
order and contextual errors.
contained many
grammatical and
contextual errors.

Page 2 of 6
Lab Learning Outcomes
After completing this lab, you should be able to understand the LabVIEW environment, block
diagram construction, front panel, LabVIEW controls and functions, basics of LabVIEW
programming, plotting, and debugging.
Introduction
LabVIEW is a graphical programming environment that has become dominant throughout
research labs, academia, and industry. It is a powerful software for measurement and automation.
It is a graphical programming language (G programming), i.e., coding is performed using a
graphical block diagram that compiles into machine code. LabVIEW offers more flexibility than
standard laboratory instruments. Using LabVIEW, the programmer can originate exactly the type
of virtual instrument needed and programmers can easily view and modify data or control inputs.
The popularity of the National Instruments LabVIEW graphical dataflow software for beginners
and experienced programmers in so many different engineering applications and industries due
to its built-in graphical programming language used for automating measurement and control
systems.
To start a LabVIEW program use, Select File followed by New VI, or simply press Ctrl + N.
Virtual Instruments (VIs)
LabVIEW graphical programs are called virtual instruments (VIs). The VIs are based on the
concept of data flow programming. This means that a block executes when data is made
available at its inputs. The output data of the block are then sent to all other connected blocks.
Data flow programming allows multiple operations to be performed in parallel since their
execution is determined by the flow of data. A VI contains two main components, a front panel,
and a block diagram.
A front panel contains inputs and outputs and provides the user interface of a program. The
inputs to a VI are represented by controls such as knobs, pushbuttons, and dials. The outputs
from a VI are represented by indicators like graphs, LEDs (light indicators), and meters. When
VI runs, its front panel provides a display of the program.
A block diagram includes the graphical code that contains terminal icons, nodes, wires, and
structures. Terminal icons are controls and indicators that appear on the front panel and are used
as interfaces between the front panel and a block diagram for data exchange. Whenever a control
or indicator is placed on a front panel, a terminal icon gets added to the corresponding block
diagram. A node represents an object that has input and/or output connectors and performs a
certain function like subVIs and functions. The wires establish the flow of data and structures
such as repetitions or conditional executions. When a VI is located within the block diagram of
another VI, it is called a subVI.

Graphical Environment – Functions and Palettes


1. Controls Palette can be displayed by right-clicking on an open area of a front panel.
2. Functions Palette can be displayed by right-clicking on an open area of a block diagram.
Controls and Functions Palettes can be customized as shown in Figure 1.

Page 3 of 6
Figure 1 Customizing menu for control and function palette.

Data Types
LabVIEW supports multiple data types like integer, double, string, Boolean, and enumerated
(string labels with corresponding integer values. It is handled as an unsigned integer). The data
can be in scalar or array format.

Fixing Errors/Bugs
By double-clicking on the error message, LabVIEW will show the location of an error. The error
is broken wires. To remove them click Ctrl+B from the keyboard to remove broken wires.

Getting Help
To access help in LabVIEW, simply press Ctrl+H or the Help button in the context window, i.e.,
select Help followed by LabVIEW Help or blue detailed help. Moreover, this can be tried on
different objects on the Block Diagram.
LabVIEW Quick Reference Guide
In addition to the above, the reference guide is provided in LabVIEW by default.

Figure 2 LabVIEW reference guide.

Structures

Page 4 of 6
A structure is represented by a graphical enclosure. The graphical code enclosed by a structure is
repeated or executed conditionally.
While Loop: While loops allow portions of an application to execute repeatedly until a certain
condition is met. in while loop denotes the number of completed iterations and
represents the conditional termination.
For Loop: For loops allow portions of an application to execute repeatedly for a fixed number of
times. Like while loop, represents the number of completed iterations, and denotes the
number of times the loop is to be repeated.
Case Structure: Case structures can be used to selectively execute code based on the value of a
condition. The selector terminal allows running different sets of operations depending on

the value it receives. The case selector shows the status being executed.

Plotting
There are multiple ways to plot the data. Charts and graphs are two widely used indicators to plot
numerical data.
A chart is a special type of numeric indicator that displays one or more plots of data typically
acquired at a constant rate. The graph, however, plots only single-valued functions with points
evenly distributed along the x-axis, such as acquired time-varying waveforms. To plot, use a
graphical pallet on the front panel. To further understand the difference between a chart and a
graph, use the given VI.

Project Explorer
Project Explorer keeps all your files for a specific project in one place and thereby a good
structure.

Figure 3 Illustration to explore the project.

Page 5 of 6
It is recommended to use this when you create larger applications that contain lots of VIs and
other files.
LabVIEW IDE can be customized by selecting Tools followed by Options.

Conclusion
To maximize performance, programmers develop software applications every day and
productivity in variations. LabVIEW is a powerful tool that can be used to help achieve these
goals.
LabVIEW virtual equipment engineering is a graphics-based programming Language that can be
ideal for Test and Measurement (T & M), automation, device control, data acquisition, and Data
Analysis applications.
Task
1. Run the given VI and then go through its block diagram. Explain the code used to generate
these graphs. Describe the purpose of the timer used in the loop.
2. Modify the given VI that takes a fast Fourier transform (FFT) of a sine wave and displays it
in the time and frequency domain.
3. Write a program that takes the temperature degree Celsius as input from the user and displays
the equivalent degree Fahrenheit.
4. Write a program that runs continuously and turns an LED on a number that is an integer
multiple of 5 (i.e., 5, 10, 15). The LED should be turned OFF for all other conditions.
5. Write a program that takes an 8-bit binary coded decimal (BCD) number, then displays the
corresponding decimal number and the message showing the number of bits High (i.e., 1), for
example, the number 0000 1001 is equal to 9 and it has two number of High bits.
6. Using case structure and enumerated data, develop a code to add, subtract, multiply, and
divide a number by another number. Use a while loop to run the code continuously.

Page 6 of 6

You might also like