0% found this document useful (0 votes)
12 views

Lab_206L_1

lab1

Uploaded by

Net Frd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lab_206L_1

lab1

Uploaded by

Net Frd
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Department of Electrical & Computer Engineering

University of New Mexico at Albuquerque

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:

1. Temperature Conversion: Develop a program to perform conversions between


Fahrenheit and Celsius temperatures. This involves creating functions to convert
temperatures from Fahrenheit to Celsius and vice versa, thereby gaining experience
in handling numeric data, implementing mathematical formulas, and designing user
interfaces in LabVIEW.
2. Line Slope Calculation: Create a program to calculate the slope of a line given the
coordinates of two points. This task involves using the slope formula to compute and
display the slope, providing insights into performing mathematical operations and
managing user inputs in LabVIEW.

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

Figure 1: Celsius to Fahrenheit LabVIEW Program


Figure 2: Fahrenheit to Celsius LabVIEW Program
Figure 3: Slope Calculator LabVIEW Program
Figure 4: Slope Calculator LabVIEW Program

List of Tables

TABLE 1: Results for Celsius to Fahrenheit Program


TABLE 2: Results for Fahrenheit to Celsius Program
TABLE 3: Results of the Slope Program

Background and Reference


Path:

 Lab Manual

References:
 Getting Started with LabVIEW.
https://www.ni.com/getting-started/labview-basics/environment

 LabVIEW Technical Resources:


https://www.ni.com/en-us/support.html
,
3|Page
Lab Procedure and Equipment

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 (℉).

Figure1: Celsius to Fahrenheit LabVIEW Program

Program 2: Fahrenheit (℉) to Celsius (℃)


The formula for converting degrees Fahrenheit to degrees Celsius is:
℃ = (℉ − 32) ÷ 1.8
where F represents Fahrenheit and C represents Celsius. This formula was used to program
the conversion in LabVIEW software. The program was developed using the steps from
Program 1 to create a temperature conversion function from degrees Fahrenheit to degrees
Celsius.

Figure 2: Fahrenheit to Celsius LabVIEW Program

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

Figure 3: Slope Calculator LabVIEW Program

Slope calculator programmed in LabVIEW SubVI.

Figure 4: Slope Calculator LabVIEW SubVI

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℉

Program 2: Fahrenheit to Celsius


Conversion Formula for Fahrenheit to Celsius is:
℃ = (℉ − 32) ÷ 1.8
Example:
For 50℉
℃ = (50 − 32) ÷ 1.8=10℃
For -112℉
℃ = (-112 − 32) ÷ 1.8=-80℃

Program 3: Slope Calculator


Slope Formula : Slope (m) = 2 − 1
2− 1

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

10℃ 50℉ 50℉


0 0
-15℃ 5℉ 5℉
0 0
-80℃ -112℉ -112℉
0 0
-40℃ -40℉ -40℉
0 0
-300℃ -508℉ -508℉
0 0
-273.15℃ -459.67℉ -459.67℉
0 0

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

Fahrenheit ℉ Calculated value (℃) Measured value (℃) Error % error

50℉ 10℃ 10℃


0 0
5℉ -15℃ -15℃
0 0
-112℉ -80℃ -80℃
0 0
-40℉ -40℃ -40℃
0 0
-500℉ -295.556℃ -295.556℃
0 0
-459.67℉ -273.15℃ -273.15℃
0 0

The program is correct to converting of Celsius to Fahrenheit up to absolute zero. For above
it shows erroneous result.
Program 3: Slope Formula

Point 1 Point 2 Calculated value Measured Error % error


(Slope) value (Slope)
(1,1) (2,2) 1 1
0 0
(2,2) (1,1) 1 1
0 0
(2,3) (3,3) 0 0
0 0
(1,1) (1,2) inf inf
0 0
(1,2) (1,1) -inf -inf
0 0
(1,2) (1,1) -inf -inf
0 0

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.

2. What are the three palettes? Briefly describe each.

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.

3. How is data passed in LabVIEW?

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.

5. Explain the two methods of creating a subVI

There are two methods to create a subVI in LabVIEW:

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

You might also like