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

Introduction To Labview: Exercise 1

The document provides instructions for creating a LabVIEW virtual instrument (VI) to calculate the sum and average of two input numbers and generate a warning if the average exceeds a threshold value. The steps include: 1. Opening LabVIEW and creating a new blank VI with a front panel and block diagram 2. Adding numeric controls to the front panel as inputs and indicators as outputs 3. Using functions like Add and Divide on the block diagram and wiring the inputs and outputs 4. Enclosing the objects in a while loop to run the VI continuously 5. Verifying that the VI calculates the correct sum and average and generates a warning when needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Introduction To Labview: Exercise 1

The document provides instructions for creating a LabVIEW virtual instrument (VI) to calculate the sum and average of two input numbers and generate a warning if the average exceeds a threshold value. The steps include: 1. Opening LabVIEW and creating a new blank VI with a front panel and block diagram 2. Adding numeric controls to the front panel as inputs and indicators as outputs 3. Using functions like Add and Divide on the block diagram and wiring the inputs and outputs 4. Enclosing the objects in a while loop to run the VI continuously 5. Verifying that the VI calculates the correct sum and average and generates a warning when needed.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Introduction to LabVIEW

Aim:
1. To get familiarized with the LabVIEW programming environment.
2. To create a Virtual Instrument (VI) which performs the sum and average of two
input numbers and to set a warning when the average exceeds a certain
threshold.

Apparatus required:

PC with LabView software

Exercise 1:

1. One can launch LabVIEW by double-clicking on the LabVIEW icon, which


opens the dialog window shown in Fig. 1.

Fig. 1: Starting LabVIEW

2. To create a new VI, click on the Blank VI under New, as shown in Fig. 2.
This can also be done by choosing File-New VI from the menu. As a result,
a blank front panel and a blank block diagram window appear as see in
Fig. 2. Remember that a front panel and block diagram coexist when one
builds a VI, meaning that every VI will have both a front panel and an
associated block diagram.
Fig. 2: Blank VI

The number of VI inputs and outputs is dependent on the VI function. In


this example, two inputs and two outputs are needed, one output
generating the sum and the other generating the average of the two input
values.

3. Create the inputs by locating two numeric controls on the front panel.
This can be done by right-clicking on an open area of the front panel to
bring up the Controls palette, followed by choosing Controls-Modern-
Numeric-Numeric Control and named as X and Y as shown in Fig. 3. Each
numeric control automatically places a corresponding terminal icon on
the block diagram as shown in Fig. 4.

Fig. 3: Front Panel Configuration


Fig. 4: Block Diagram Panel Configuration

4. Similarly, the outputs are created by locating two numeric indicators


(Controls-modern-Numeric-Numeric indicator) on the front panel. Each
numeric indicator automatically places a corresponding terminal icon on
the block diagram. Edit the labels of the indicators to read “Sum“ and
“Average.”
5. Next, place an Add function (Function-Express-Arithmetic & Comparison-
Express numeric-Add) and a divide function (Function-Express-Arithmetic
& Comparison-Express numeric-Divide) on the block diagram. Enter the
divisor, in this case 2, in a Numeric constant (Function-Express-
Arithmetic & Comparison-Express numeric Numeric constant) and
connect it to the y terminal of the divide function using the Wiring tool.
6. Fig. 5 illustrates the wires placed between the terminals of the numeric
controls and the input terminals of the Add function. Notice that the
label of a terminal gets displayed whenever one moves the cursor over
the terminal if the automatic tool selection mode is enabled. Also, note
that the Run button on the toolbar remains broken until one completes
the wiring process.
Fig. 5: Wiring Block Diagram Objects.

7. To view or hide the label of a block diagram object, such as a function,


right-click on the object and check (or uncheck) Visible items- Label from
the shortcut menu as shown in Fig. 6.

Fig. 6: Completed Block Diagram.


Fig. 7: VI Verification

Exercise 2:

1. If the average of the two inputs becomes greater than a preset


threshold value, a LED warning light turns on.

Fig. 8: (a) Front Panel, (b) Block Diagram.

2. First, build a front panel as shown in Fig.8 a. For the inputs, consider two
knobs(controls-modern-numeric-knob). Adjust the size of the knobs by
using the Positioning tool. Label the second knob as Input 2 and repeat all
the adjustments as carried out for the first knob.
3. To set the outputs, locate and place a numeric indicator, a round LED
(control-modern-boolean-Round LED) and a gauge (Controls-Modern-
Numeric-Gauge). Edit the labels of the indicators as shown in Fig. 8.
4. Locate a greater or Equal? function from (Functions-Programming-
comparison-greater or equal) to compare the average output with a
threshold value.
5. To run the VI continuously, use a while loop structure. Choose Functions-
Programming-structures-While loop. Change the size by dragging the
mouse to enclose the objects in the while loop, as illustrated in Fig.9.

Fig. 9: While Loop Enclosure.

6. Once this structure is created, its boundary, together with the loop iteration
terminal and conditional terminal, get shown on the block diagram. If one
creates the while loop by using function-programming-structures-while loop,
the stop button is not included as part of the structure. One can create this
button by right-clicking on the conditional terminal and choosing Create-
control from the shortcut menu. It is possible to wire a Boolean condition to
a conditional terminal, instead of a stop button, to stop the loop
programmatically.

7. Next run the VI to verify its functionality. After clicking the Run button on
the toolbar, adjust the knobs to alter the inputs. Verify whether the average
and sum are displayed correctly in the gauge and numeric indicators.
Fig. 10: Front Panel as VI Runs.

Exercise 3
Generate a VI which calculates the length of hypotenuse of a right angled triangle when
the length of the other two sides are given as input.

You might also like