Labview Programs
Labview Programs
Contents
S.No Title Page No
1. Syllabus 2-2
7. Appendix-1 49-52
Syllabus:
Course Objectives:
Locate various tool bars and pull-down menus for the purpose of implementing specific functions.
Course Outcomes:
Use the programming structures and data types that exist in LabVIEW
Long hair, dangling jewelry and loose or baggy clothing are a hazard in the
laboratory.
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.
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
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
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.
• 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
Algorithm:
Step 1: Start the Lab view and select the blank VI.
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.
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 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.
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
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
A
Y
Truth Table
A B
0 0 1
0 1 0
1 0 0
1 1 0
Truth Table
A B Y=AB
0 0 0
0 1 1
1 0 1
1 1 0
Algorithm:
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:
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
Algorithm:
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.
Result: Thus the factorial of a given number is using FOR loop is performed in LAB view.
Exp No: 5
Algorithm:
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.
Algorithm:
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.
Result: Thus the factorial of the given number using WHILE loop is performed.
Exp No:7
Algorithm:
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 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.
Exp No:8
Algorithm:
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.
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 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
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)
Algorithm:
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.
Result: Hence the basic calculator (using formula node) is simulated using LabVIEW.
Exp No: 11
Algorithm:
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.
Algorithm:
Step 2: Right click on the front panel, select program, go to numeric and select
numericnumeric control , select numeric multiply, select numericSquare
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.
Front panel
Result: Hence the area and perimeter of a circle is calculated using LabVIEW.