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

Labview Programs

Uploaded by

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

Labview Programs

Uploaded by

ticslogis8
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

APPROVED BY AICTE NEW DELHI, AFFILIATED TO VTU BELGAUM

DEPARTMENT OF ELECTRONICS & COMMUNICATION


ENGINEERING

LAB VIEW PROGRAMMING


LAB MANUAL – BEC358A
III-SEMESTER
2023-2024

Prepared by: Reviewed by: Approved by:

Dr. Deepa A Dr. S. Anantha Padmanabhan Dr.Basavaraju C


Assistant Professor Head of the Department Principal
Dept. of ECE Dept. of ECE GCEM
GCEM GCEM

81/1, 182/1, Hoodi Village, Sonnenahalli, K.R. Puram, Bengaluru,


Karnataka-560048.

Contents
S.No Title Page No

1. Syllabus 2-2

2. Course objective 2-2

3. Course outcome 3-3

4. Do’s & Don’ts 4-4

5. List of experiments 5-46

6. Viva questions 47-48

7. Appendix-1 49-52
Syllabus:
Course Objectives:

 Aware of various front panel controls and indicators.

 Connect and manipulate nodes and wires in the block diagram.

 Locate various tool bars and pull-down menus for the purpose of implementing specific functions.

 Locate and utilize the context help window.

 Familiar with LabVIEW and different applications using it

Course Outcomes:

 Use LabVIEW to create data acquisition, analysis and display operations

 Create user interfaces with charts, graph and buttons

 Use the programming structures and data types that exist in LabVIEW

 Use various editing and debugging techniques.


Do’s & Dont’s
Do’s

 Conduct yourself in a responsible manner at all times in the laboratory.

 Dress properly during a laboratory activity.

 Long hair, dangling jewelry and loose or baggy clothing are a hazard in the
laboratory.

 Observe good housekeeping practices.

 Replace the materials in proper place after work to keep the lab area tidy.

Dont’s

 Do not wander around the room, distract other students, startle other students or
interfere with the laboratory experiments of others.

 Do not eat food, drink beverages or chew gum in the laboratory and do not use
laboratory glassware as containers for food or beverages.

 Do not open any irrelevant internet sites on lab computer

 Do not use a flash drive on lab computers.

 Do not upload, delete or alter any software on the lab PC.


List of Experiments

EXPT. PAGE
NO. Name of the Experiment NO.

Introduction 7
Study of Labview software flow
01 Basic arithmetic operations: addition, subtraction, multiplication and division 10

02 Boolean operations: AND, OR, XOR, NOT and NAND 14

03 Sum of ‘n’ numbers using ‘for’ loop 18

04 Factorial of a given number using ‘for’ loop 21

05 Determine square of a given number 23

06 Factorial of a given number using ‘while‘ loop 27

07 Sorting even numbers using ‘while’ loop in an array 29

08 Finding the array maximum and array minimum 32

Demonstration Experiments (For CIE) 39

Build a Virtual Instrument that simulates a heating and cooling system. The
09 42
system must be able to be controlled manually or automatically.

10 Build a Virtual Instrument that simulates a Basic Calculator (using formula node). 44

11 Build a Virtual Instrument that simulates a Water Level Detector. 46

Demonstrate how to create a basic VI which calculates the area and perimeter of
12
a circle.
INTRODUCTION
LabVIEW programs are called virtual instruments (VIs). Controls are inputs and indicators are
outputs.

Each VI contains three main parts:

• Front panel – How the user interacts with the VI

• Block diagram – The code that controls the program

• Icon/connector – The means of connecting a VI to other VIs In LabVIEW, you build a user interface
by using a set of tools and objects.

The user interface is known as the front panel. You then add code using graphical representations of
functions to control the front panel objects.

The block diagram contains this code. In some ways, the block diagram resembles a flowchart. You
interact with the front panel when the program is running.

You can control the program, change inputs, and see data updated in real time. Controls are used for
inputs such as adjusting a slide control to set an alarm value, turning a switch on or off, or stopping a
program.

Indicators are used as outputs. Thermometers, lights, and other indicators display output values
from the program. These may include data, program states, and other information.

Every front panel control or indicator has a corresponding terminal on the block diagram. When you
run a VI, values from controls flow through the block diagram, where they are used in the functions
on the diagram, and the results are passed into other functions or indicators through wires.
Use the Controls palette to place controls and indicators on the front panel. The Controls palette is
available only on the front panel. To view the palette, select Window»Show Controls Palette. You
also can display the Controls palette by rightclicking an open area on the front panel. Tack down the
Controls palette by clicking the pushpin on the top left corner of the palette.

Use the Functions palette to build the block diagram. The Functions palette is available only on the
block diagram. To view the palette, select Window»Show Functions Palette. You also can display the
Functions palette by right-clicking an open area on the block diagram. Tack down the Functions
palette by clicking the pushpin on the top left corner of the palette.
 If you enable the automatic selection tool and you move the cursor over objects on the
front panel or block diagram, LabVIEW automatically selects the corresponding tool
from the Tools palette. Toggle automatic selection tool by clicking the Automatic
Selection Tool button in the Tools palette.
 Use the Operating Tool to change the values of a control or select the text within a
control.
 Use the Positioning/Resizing Tool to select, move, or resize objects. The Positioning
Tool changes shape when it moves over a corner of a resizable object.
 Use the Labeling Tool to edit text and create free labels. The Labeling Tool changes
to a cursor when you create free labels.
 Use the Wiring Tool to wire objects together on the block diagram.
Other important tools:

• Click the Run button to run the VI. While the VI runs, the Run button appears with a black arrow if
the VI is a top-level VI, meaning it has no callers and therefore is not a sub VI.
• Click the Continuous Run button to run the VI until you abort or pause it. You also can click the
button again to disable continuous running.

• While the VI runs, the Abort Execution button appears. Click this button to stop the VI immediately.

When your VI is not executable, a broken arrow is displayed in the Run button in the palette.

• Finding Errors: To list errors, click on the broken arrow. To locate the bad object, click on the error
message.

• Execution Highlighting: Animates the diagram and traces the flow of the data, allowing you to view
intermediate values. Click on the light bulb on the toolbar.

• Probe: Used to view values in arrays and clusters. Click on wires with the Probe tool or right-click
on the wire to set probes.

• Retain Wire Values: Used with probes to view the values from the last iteration of the program.

• Breakpoint: Sets pauses at different locations on the diagram. Click on wires or objects with the
Breakpoint tool to set breakpoints.

Procedure
Setting up a Blank VI
1. Open LabVIEW and select Blank VI under Create Project.
2. Click Window > Tile Left and Right to display the front panel (left window) and back
panel (right window) side by side. This will make them visible at the same time,
making it easier to work.
3. With the back panel selected, click View > Tools Palette to open the Tools palette.
4. With the front panel selected, click View > Controls Palette. The workspace should
look like Figure 16. To open the Controls palette in the future, simply right click in
the front panel. Similarly, to open the Functions palette, simply right click in the
back panel.

Labview Programs:
Exp No: 1

BASIC ARITHMETIC OPERATIONS: ADDITION, SUBTRACTION,


MULTIPLICATION AND DIVISION
Aim: To perform basic arithmetic operations using Labview.

Algorithm:

Step 1: Start the Lab view and select the blank VI.

Step 2: Create front and block diagram panel.

Step 3: Numeric controls are given as inputs and numeric indicators are given as output they are
selected by right clicking on the front panel.

Step 4: Different arithmetic operators such as addition, subtraction, multiplication and division are
generated in block diagram panel.

Step 5: Using wiring operation inputs and outputs are connected to the respective operators in the
block diagram panel.

Step 6: Input values are given in the front panel and the program is executed. Hence the output is
generated.

Front panel and Block Diagram Panel:

Result:

Thus the arithmetic operations were performed and the result is verified using lab view.

Exp No: 2
BOOLEAN OPERATIONS: AND, OR, XOR, NOT AND NAND
Aim: To perform Boolean operations using Labview.

Algorithm:

Step 1: Start the Labview and select the blank VI.

Step 2: Create front and block diagram panel.

Step 3: To perform Boolean operation push buttons are taken as inputs and round LED as output.

Step 4: Different Boolean operations such as AND, OR, XOR, NOT, NAND are selected from the block
diagram panel.

Step 5: Boolean inputs and outputs are wired in the block diagram panel.

Step 6: Logic values 0 & 1 are given in the front panel and the program is executed.

Front panel and Block diagram:

Truth Table:
AND GATE (7408)

A Y

Truth Table

A B Y=A.B

0 0 0

0 1 0

1 0 0

1 1 1

OR GATE (7432)

A
Y

Truth Table

A B Y=A+B

0 0 0

0 1 1

1 0 1

1 1 1

NOT GATE (7404)

Truth Table

A Y=Ā
0 1

1 0

NAND GATE:

A
Y

Truth Table

A B

0 0 1

0 1 1

1 0 1

1 1 0

NOR GATE (7402)

A
Y

Truth Table

A B
0 0 1
0 1 0
1 0 0
1 1 0

EX-OR GATE (7486)


A
Y

Truth Table

A B Y=AB

0 0 0

0 1 1

1 0 1

1 1 0

RESULT: Thus the Boolean operation using LAB view is performed.


Exp No: 3

SUM OF ‘N’ NUMBERS USING ‘FOR’ LOOP


Aim: To find the sum of ‘n’ numbers using FOR loop.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel, select program , go to structures and select a FOR
loop.

Step 3: Right click on the border of the FOR loop and select add shift register, borders are converted
into shift register.

Step 4: Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed. Block diagram:

Front panel and Block diagram:

Result: Thus the sum of ‘n’ natural numbers using FOR loop is performed in LABview.

Exp No: 4
FACTORIAL OF A GIVEN NUMBER USING FOR LOOP

Aim: To perform the factorial of a given number using FOR loop.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel , select program , go to structures and select a FOR
loop.

Step 3: Right click on the border of the FOR loop and select add shift register, borders are converted
into shift register.

Step 4: Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed.

Front panel and Block diagram:

Result: Thus the factorial of a given number is using FOR loop is performed in LAB view.
Exp No: 5

DETERMINE SQUARE OF A GIVEN NUMBER

Aim: To perform the factorial of a given number using FOR loop.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel , select program ,

Step 4: Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed.

Result: Thus the square of a given number is performed in LAB view.


Exp No: 6

FACTORIAL OF A GIVEN NUMBER USING WHILE LOOP

Aim: To perform the factorial of a given number using WHILE loop.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel , select program , go to structures and select a WHILE
loop.

Step 3: Right click on the border of the WHILE loop and select add shift register, borders are
converted into shift register.

Step 4: Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed.

Font panel and Block diagram panel:

Result: Thus the factorial of the given number using WHILE loop is performed.
Exp No:7

SORTING EVEN NUMBERS USING WHILE LOOP IN AN ARRAY

Aim: To sort even numbers using WHILE loop in an array.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel, select program, go to structures and select a WHILE
loop.

Step 3: Create an array in the front panel and add numeric indicator to it.

Step 4: Add the numeric control in the front panel.

Step 5: Using wiring operations required connections are given in the block diagram.

Step 6: Inputs are given in the front panel and the program is executed.

Font panel and Block diagram panel:


Result: Thus the even numbers from the given set of numbers is sorted using WHILE loop in an array.

Exp No:8

FINDING THE ARRAY MAXIMUM AND ARRAY MINIMUM

Aim: To find the maximum and minimum variable from an array.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the front panel →modern →array→ array matrix→ numeric control.

Step 3: Create four numeric indicators in the front panel for maximum variable, index,
minimum variable and index.

Step 4: Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed.

Font panel and Block diagram panel:

Result: Hence the maximum and minimum


values of array were displayed using LabVIEW.

Exp No: 9
BUILD A VI THAT SIMULATES A HEATING AND COOLING SYSTEM. THE SYSTEM MUST BE
CONTROLLED MANUALLY OR AUTOMATICALLY.

Aim: To simulate a heating and cooling system that must be controlled manually or
automatically

Algorithm:

Step 1: Create blank VI.

Step 2: The air conditioner is turned on when the temperature is above 95°F. The heater is
turned on when the temperature is less than 75°F. The heater and the air conditioner are
turned off when the temperature is between 75°F and 90°F.

Step 3: In the front panel, drag and drop three round LEDs and three slide switches from the
Boolean menu (under Modern in the Controls Palette) to represent the AC, the heater, and
manual mode. Rename the LEDs and switches to "Manual," "AC," and "Heater" to make
wiring easier

Step 4: Drag and drop a thermometer from the Numeric menu (under Modern in the
Controls Palette) into the front panel. Right click the thermometer and select Change to
Control and double check that the icon in the back panel is a control.

(This means that the thermometer will act as an input and can be controlled by the mouse
while the program is running)

Step 5: In the back panel, insert a case structure from the Programming menu (in
the Functions Palette) to control the manual and automatic operation of the AC and heater.
(Set the case structure to True/False if not already set to that)

Step 6: In the back panel, wire the switch designated as "Manual" to the question mark
symbol on the case structure. This means that when the manual switch is on ("true") the
case structure will perform its true statement and when the manual switch is off ("false")
the case structure will perform its false statement. The air conditioner is turned on when the
temperature is above 95°F

Step 7: Because the temperature of the room only matters when the system is not in manual
mode, move the thermometer icon into the False case structure. Click the small arrow next
to "True" to toggle between the two cases

Step 8: In the true case, wire the AC and Heater switches directly to their corresponding
LEDs. Insert a true constant from the Boolean menu in the Functions Palette under
Programming. Wire the constant to the Manual LED so that the Manual LED is on when the
Manual switch is "true"

Step 9: In the false case, insert two numeric constants, one greater than, and one less than.
These will be used to control the VI in automatic mode
Step 10: Wire the thermometer to the less than and greater than. Set a numeric constant to
60 and the other to 80. Wire the 60 numeric constant to the less than symbol and the 80
numeric constant to the greater than symbol. Make sure the thermometer is wired to the
top left of the inequalities and the constants are wired to the bottom left of the inequalities.

Step 11: Hit the run button to control and test your VI

Front panel and Block diagram panel:

Result: Hence the heating and cooling system is simulated manually and automatically using
LabVIEW.
Exp No: 10

BUILD A VIRTUAL INSTRUMENT THAT SIMULATES A BASIC CALCULATOR (USING FORMULA NODE)

Aim: To simulate a basic calculator (using formula node)

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the block diagram panel, select program, go to structures and select a formula
node.

Step 3: Right click on the border of the formula node and select add inputs at input side and add
outputs at output side.

Step 4: Right click on the front panel, select numeric -> numeric indicator for various operations.
Using wiring operations required connections are given in the block diagram.

Step 5: Inputs are given in the front panel and the program is executed.

Block diagram panel:


Front panel

Result: Hence the basic calculator (using formula node) is simulated using LabVIEW.
Exp No: 11

BUILD A VIRTUAL INSTRUMENT THAT SIMULATES A WATER LEVEL DETECTOR.

Aim: To simulate a water level detector.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the front panel, select program, go to numeric and select a knob and tank.

Step 3: Right click on the front panel, select numeric -> numeric indicator for various operations.
Using wiring operations required connections are given in the block diagram.

Step 4: Inputs are given in the front panel and the program is executed.

Block diagram panel:


Front panel

Result: Hence the water level detector is simulated using LabVIEW.


Exp No: 12

DEMONSTRATE HOW TO CREATE BASIC VI WHICH CALCULATES AREA AND PERIMETER OF


A CIRCLE.

Aim: To simulate basic VI which calculates area and perimeter of a circle.

Algorithm:

Step 1: Create blank VI.

Step 2: Right click on the front panel, select program, go to numeric and select
numericnumeric control , select numeric multiply, select numericSquare

Step 3: Right click on the front panel, select numeric -> numeric indicator for various
operations. Using wiring operations required connections are given in the block diagram.

Step 4: Inputs are given in the front panel and the program is executed.

Block diagram panel:

Front panel

Result: Hence the area and perimeter of a circle is calculated using LabVIEW.

You might also like