Summary: Use the LabVIEW documentation resources to build a VI that generates a signal, reduces the number of samples in the signal, and displays the resulting data in a table on the front panel.
Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.
In the following exercises, you will open a blank VI and add Express VIs and structures to the block diagram to build a new VI. When you complete the exercise, the front panel of the VI will appear similar to the Figure 1.
![]() |
If no template is available for the task you want to create, you can start with a blank VI and add Express VIs to accomplish the specific task. Complete the following steps to open a blank VI.
LabVIEW dialog box, click the arrow on
the New button and select Blank VI
from the shortcut menu or press the Ctrl-N keys
to open a blank VI.
Notice that a blank front panel and block diagram appear.
Functions palette is not visible,
right-click any blank space on the block diagram to display
the Functions palette. Click the thumbtack,
shown in Media 2, in the upper left corner of
the Functions palette to place the palette on
the screen.
Functions or
Controls palettes.
Complete the following steps to find the Express VI you want to use and then add it to the block diagram.
If
the Context Help window is not visible, press
the Ctrl-H keys to open the Context
Help window. You also can press the Show
Context Help Window button, shown in Media 3, to open the Context Help window.
Input palette on the
Functions palette and move the cursor over the
Express VIs on the Input palette.
Notice that the Context Help window displays
information about the function of each Express VI.
Context
Help window, find the Express VI that can simulate a
sine wave signal.
Configure Simulate Signal dialog box appears.
Configure Simulate Signal dialog box, such as
Frequency (Hz), Amplitude, and
Samples per second (Hz). Read the information
that appears in the Context Help window.
Simulate Signal Express VI to
generate a sine wave with a frequency of
Result
Preview window changes to reflect the configured sine
wave.
Configure Simulate Signal dialog box
by clicking the OK button.
Simulate Signal
Express VI and read the information that appears in the
Context Help window.
Notice that the Context Help window now
displays the configuration of the Simulate
Signal Express VI.
Reduce Samples.vi in the
C:\Exercises\LabVIEW Basics I directory.
Complete the following steps to use the LabVIEW Help to search for the Express VI that reduces the number of samples in a signal.
Help>>VI, Function, & How-To Help to
open the LabVIEW Help.
Search tab and type sample
compression in the Type in the word(s) to
search for text box.
Notice that this word choice reflects what you want this
Express VI to do-compress, or reduce, the number of samples
in a signal.
Enter key or
click the List Topics button.
Sample Compression topic to
display the topic that describes the Sample
Compression Express VI.
Place on the block diagram button to select the
Express VI.
Sample
Compression Express VI to the cursor.
Sample Compression Express VI on the
block diagram to the right of the Simulate
Signal Express VI.
Sample Compression Express VI to
reduce the signal by a factor of
Configure Sample Compression dialog
box.
Wiring tool, wire the
Sine output in the Simulate Signal
Express VI to the Signals input in the
Sample Compression Express VI.
In a previous exercise, you added
controls and indicators to the front panel using the
Controls palette. You also can add controls and
indicators from the block diagram. Complete the following
steps to create controls and indicators as shown in Figure 2.
![]() |
Mean output in the Sample
Compression Express VI and select
Create>>Numeric Indicator from the shortcut
menu to create a numeric indicator.
Mean output of the Sample
Compression Express VI and select Insert
Input/Output from the shortcut menu to insert the
Enable input.
Enable input and select
Create>>Control from the shortcut menu to
create the Enableswitch.
Sine output in
the Simulate Signal Express VI to the
Signals input in the Signal
Compression Express VI and select Create>>Graph
Indicator from the shortcut menu.
Notice that you can create controls and indicators from the
block diagram. When you create controls and indicators using
this method, LabVIEW automatically creates terminals that
are labeled and formatted correctly.
Wiring tool, wire the
Mean output in the Sample
Compression Express VI to the Sine graph
indicator terminal created in the previous step.
Notice that the Merge Signals function appears.
Clean Up
Wire from the shortcut menu to automatically route
an existing wire.
In the current state, the VI runs once, generates one signal,
then stops executing. To run the VI until a condition is met,
you can add a While Loop to the block
diagram. Complete the following steps to add a While
Loop.
Stop button.
Functions>>Execution Control palette.
While
Loop here.
![]() |
Notice that the While Loop, shown in Media 6, appears with a Stop button wired
to the condition terminal. This While Loop is
configured to stop when the user clicks the
Stop button.
Stop button. A While Loop executes
the functions inside the loop until the user presses the
Stop button. Refer to Repetition and Loops for more information
about While Loops.
To plot the points on the waveform graph more slowly, you can add a time delay to the block diagram. Complete the following steps to control the speed at which the VI executes.
Time Delay
Express VI on the Functions>>Execution Control
palette and place it inside the loop.
Time delay (seconds) text box.
This time delay specifies how fast the loop runs. With a
Configure Time Delay dialog box.
Enable switch and notice the change
on the graph.
Notice how if the Enable switch is on, the
graph displays the reduced signal. If the
Enable switch is off, the graph does not
display the reduced signal.
Stop button to stop the VI.
Complete the following steps to display a collection of mean values in a table on the front panel.
Controls>>Text Indicators palette and place
it on the front panel to the right of the waveform graph.
Table terminal appears wired to
the Build Table Express VI automatically.
If the Build Table Express VI and the
Table terminal are not selected already, click
an open space on the block diagram to the left of the
Build Table Express VI and the
Table terminal. Drag the cursor diagonally
until the selection rectangle encloses the Build
Table Express VI and the Table terminal,
shown in Media 7.
A moving dashed outline called a marquee highlights the
Build Table Express VI, the Table
terminal, and the wire joining the two.
While Loop to the
right of the Mean terminal.
Notice that the While Loop automatically
resizes to enclose the Build Table Express VI
and the Table terminal.
Wiring tool, wire the
Mean terminal of the Sample
Compression Express VI to the Signals
input of the Build Table Express VI.
The block diagram should appear similar to Figure 4.
![]() |
Enable switch.
The table displays the mean values of every
Enable switch is off, the table does not
record the mean values. Table Properties
dialog box. For example, try changing the number of
columns to one.
"A full introductory course on programming with LabVIEW."