Introduction To Labview: Exercise 1
Introduction To Labview: Exercise 1
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:
Exercise 1:
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
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.
Exercise 2:
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.
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.