Lab_206L_1
Lab_206L_1
ECE206 L
Experiment-1
The LabVIEW Programming Environment and Basic Operations
Authors:
Date:
1|Page
Table of Contents
Abstract ................................................................................................................................. 3
List of Figures ....................................................................................................................... 3
List of Tables ......................................................................................................................... 3
Background and Reference.................................................................................................. 3
Lab Procedure and Equipment ........................................................................................... 4
Procedure .......................................................................................................................................... 4
Program 1: Celsius (℃) to Fahrenheit (℉) ...................................................................................... 5
Program 2: Fahrenheit (℉) to Celsius (℃) ...................................................................................... 5
Program 3: Slope (𝑚) Calculator ..................................................................................................... 6
Theoretical Analysis ............................................................................................................. 7
Program 1, Celsius to Fahrenheit ...................................................................................................... 7
Program 2: Fahrenheit to Celsius...................................................................................................... 7
Program 3: Slope Calculator ............................................................................................................. 7
Discussion .............................................................................................................................. 9
2|Page
Abstract
This lab exercise is designed to introduce users to LabVIEW software and to develop
practical skills in programming with it. The main objectives are twofold:
By completing these tasks, users will become proficient in using LabVIEW for temperature
conversions and mathematical calculations, enhancing their ability to utilize the software for
various practical applications.
List of Figures
List of Tables
Lab Manual
References:
Getting Started with LabVIEW.
https://www.ni.com/getting-started/labview-basics/environment
Equipment:
Computer Desktop
Windows 10 pro OS
LabVIEW 2018 software
Notebook, and pencil
Procedure:
I launched LabVIEW by navigating to Start > Programs > National Instruments > LabVIEW
2022 > LabVIEW 2022. Then, I opened a new front panel by selecting File > New VI. To
view both the front panel and block diagram side by side, I chose Window > Tile Left and
Right. I created a numeric digital control to enter the value for degrees Centigrade and a
numeric indicator to display the value for degrees Fahrenheit. Next, I displayed the block
diagram by selecting Window > Show Diagram.
I selected the Multiply and Add functions from the Functions > Numeric palette and placed
them on the block diagram. I also added two numeric constants from the Functions >
Numeric palette, setting one to 1.8 and the other to 32.0. Using the Wiring tool, I connected
the icons in the block diagram. Afterward, I saved the file by choosing File > Save, entering
"ConvertCtoF.vi" in the dialog box, and clicking the Save button. Finally, I entered a number
in the numeric control to run the VI.
I followed the same steps to develop a program for converting Fahrenheit to Celsius and
another program to calculate the slope of a line, adjusting the number of numeric digital
controls as needed for each task.
4|Page
Program 1: Celsius (℃) to Fahrenheit (℉)
The formula for converting degrees Celsius to degrees Fahrenheit is:
℉ = (℃ × 1.8) + 32
where F represents Fahrenheit and C represents Celsius. This formula was used to
program the conversion in LabVIEW software. The program was created by following the
steps outlined above to develop a temperature conversion function from Celsius (℃) to
Fahrenheit (℉).
5|Page
Program 3: Slope (𝒎) Calculator
Using the techniques described in Part 1, a VI was created to calculate the slope of a line.
The code was then converted into a subVI using the Edit » Create SubVI method. The VI
was saved as Slope.vi, and the subVI was saved as SlopeSub.vi.
The formula for the slope is as below:
𝑦2 − 𝑦2
𝑚=
𝑥2 − 𝑥1
6|Page
Theoretical Analysis
Program 1, Celsius to Fahrenheit
Conversion Formula for Celsius to Fahrenheit is:
℉ = (℃ × 1.8) + 32
Example:
For 10℃
℉ = (10× 1.8) + 32=50℉
For -15℃
℉ = (-15× 1.8) + 32=5℉
Example:
For (1,1), (2,2) Slope (m) =(2-1)/(2-1)=1
Verification Results
Program 1: Celsius to Fahrenheit
Celsius ℃ (input) Calculated value (℉) Measured value (℉) Error % error
The program is correct to converting of Celsius to Fahrenheit up to absolute zero. For above
it shows erroneous result.
7|Page
Program 2: Fahrenheit to Celsius
The program is correct to converting of Celsius to Fahrenheit up to absolute zero. For above
it shows erroneous result.
Program 3: Slope Formula
Results:
The lab was carried out to become familiar with the LabVIEW software and to
develop a program for converting Celsius to Fahrenheit and vice versa. Additionally, a
program was created in the lab to calculate the slope of a line. From the technical analysis, it
can be noted that a limiting factor is necessary for temperature conversions below absolute
zero in both Program 1 and Program 2. All other results for Program 1 and Program 2 are
accurate. The results obtained for Program 3 align with theoretical calculations. All results
have been recorded in the lab report.
8|Page
Discussion
1. What is a VI? What are the three main parts of a VI? Briefly describe each.
A “VI” stands for Virtual Instrument. In LabVIEW, programs are referred to as Virtual
Instruments (VIs). Each VI consists of three main components:
Front Panel: This acts as the user interface, where users can interact with the VI by
inputting data and viewing results.
Block Diagram: This contains the graphical source code that defines the VI’s
functionality. It is where the logical operations and processes are created using
LabVIEW's graphical programming language.
Icon and Connector Pane: This section identifies the VI, allowing it to be used
within other VIs. When a VI is used inside another VI, it is referred to as a subVI.
The subVI is analogous to a subroutine in text-based programming languages,
enabling modular and reusable code.
In LabVIEW, there are three primary palettes: the Tools Palette, the Controls Palette, and the
Functions Palette.
Tools Palette: Accessible from both the front panel and the block diagram, this
palette is used to operate and modify objects within these areas. It includes tools
for selecting, wiring, and editing elements.
Controls Palette: Available exclusively on the front panel, this palette contains
the controls and indicators necessary for creating the user interface. It includes
elements like buttons, sliders, and displays that allow users to interact with the VI.
Functions Palette: Found only on the block diagram, this palette provides the VIs
and functions required to build the VI’s graphical code. It includes mathematical
functions, logical operators, and other tools essential for programming the VI’s
functionality.
LabVIEW operates on a dataflow model for executing VIs (Virtual Instruments). In this
model, execution of nodes is determined by the availability of input data. When a node
completes its execution, it sends its output data to its output terminals. This output data
is then passed to the next node in the dataflow path. Nodes only execute when all their
9|Page
input data is available, ensuring that data is processed in a systematic and efficient
manner..
4. How can you tell the difference between controls and indicators on the front
panel? On the block diagram?
The main difference between controls and indicators on the front panel is their function:
Controls: These are user-editable elements where users can input or modify data.
Examples include knobs, sliders, and text boxes. Controls allow for user interaction
by enabling value changes.
Indicators: These are used to display values or results to the user. They show output
data from the VI and include elements like gauges, graphs, and LEDs.
In the block diagram, the difference is similar, but controls have a switch next to them to
enable or adjust their values. Indicators, on the other hand, are used to display data from the
VI's operations.
1. Highlight and Create SubVI: Select all the functions that you want to include in the
subVI. Right-click on the highlighted area and choose the "Create SubVI" option.
This will bundle the selected functions into a new subVI.
2. Create and Integrate Standalone VI: First, create a standalone VI for the desired
functionality. Once the standalone VI is complete, you can drag and drop it into the
block diagram of another VI to use it as a subVI.
10 | P a g e