Professional Documents
Culture Documents
ni.com
4. Click the OK button to open the template. You also can double-click the
name of the template VI in the Create new list to open the template.
5. Examine the front panel of the VI.
The user interface, or front panel, appears with a gray background and
includes controls and indicators. The title bar of the front panel indicates
that this window is the front panel for the Generate and Display VI.
If the front panel is not visible, you can display the front panel by selecting
WindowShow Front Panel.
Note
Note
7. On the front panel toolbar, click the Run button, shown at left.
Notice that a sine wave appears on the graph.
8. Stop the VI by clicking the STOP button, shown at left, on the front
panel.
1. If the Controls palette is not visible on the front panel, select Window
Show Controls Palette to display it.
2. Move the cursor over the icons on the Controls palette to locate the
Numeric Controls palette.
Notice that when you move the cursor over icons on the Controls
palette, the name of that subpalette appears in the gray space above all
the icons on the palette. When you idle the cursor over any icon on any
palette, the full name of the subpalette, control, or indicator appears.
3. Click the Numeric Controls icon to access the Numeric Controls
palette.
4. Select the knob control on the Numeric Controls palette and place it on
the front panel to the left of the waveform graph.
You will use this knob in a later exercise to control the amplitude of a
signal.
5. Select FileSave As and save this VI as Acquiring a Signal.vi in
the C:\Exercises\LV Basics I directory.
Note Save all the VIs you edit or create in this course in the C:\Exercises\
LV Basics I directory.
ni.com
4. Click the OK button to apply the current configuration and close the
Configure Simulate Signal dialog box.
5. Move the cursor over the down arrows at the bottom of the Simulate
Signal Express VI.
6. When a double-headed arrow appears, shown at left, click and drag the
border of the Express VI until the Amplitude input appears.
Notice how you expanded the Simulate Signal Express VI to display a
new input. Because the Amplitude input appears on the block diagram,
you can configure the amplitude of the sawtooth wave on the block
diagram.
In the previous figure, notice how Amplitude is an option in the
Configure Simulate Signal dialog box. When inputs, such as
Amplitude, appear on the block diagram and in the configuration dialog
box, you can configure the inputs in either location.
The cursor does not switch to another tool while an object is selected.
5. When the Wiring tool appears, click the arrow and then click the
Amplitude input of the Simulate Signal Express VI, shown at left, to
wire the two objects together.
Notice that a wire appears and connects the two objects. Data flows
along this wire from the terminal to the Express VI.
6. Select FileSave to save this VI.
ni.com
Running the VI
Running a VI executes your solution. Complete the following steps to run
the Acquiring a Signal VI.
1. Display the front panel by selecting WindowShow Front Panel or by
clicking the front panel.
Press the <Ctrl-E> keys to switch from the front panel to the block diagram or from
the block diagram to the front panel.
Tip
Note
6. Click the OK button to apply the current configuration and close the
Configure Scaling and Mapping dialog box.
ni.com
7. Move the cursor over the arrow on the Sawtooth output of the Simulate
Signal Express VI.
8. When the Wiring tool appears, click the arrow and then click the arrow
on the Signals input of the Scaling and Mapping Express VI, shown at
left, to wire the two objects together.
9. Using the Wiring tool, wire the Scaled Signals output of the Scaling and
Mapping Express VI to the Waveform Graph terminal.
Notice the wires connecting the Express VIs and terminals. The arrows
on the Express VIs and terminals indicate the direction that the data
flows along these wires. The block diagram should appear similar to the
following figure.
3. Select FileSave to save this VI. You also can press the <Ctrl-S> keys
to save a VI.
4. Return to the front panel, run the VI, and turn the knob control.
Notice that the graph plots the sawtooth wave and the scaled signal. Also
notice that the maximum value on the y-axis automatically changes to
be 10 times the knob value. This scaling occurs because you set the slope
to 10 in the Scaling and Mapping Express VI.
5. Click the STOP button.
10
ni.com
3. Click the Scale tab and in the Scale Range section, change the
maximum value to 5.0.
Notice how the knob on the front panel instantly updates to reflect these
changes.
4. Click the OK button to apply the current configuration and close the
Knob Properties dialog box.
5. Save this VI.
As you build VIs, you can experiment with different properties and configurations.
You also can add and delete objects. Remember you can undo recent edits by selecting
EditUndo or pressing the <Ctrl-Z> keys.
Tip
11
3. Right-click the waveform graph and select Properties from the shortcut
menu to display the Graph Properties dialog box.
4. On the Plots tab, select Sawtooth from the pull-down menu. Click the
Line Color color box to display the color picker. Select a new line color.
5. Select Sawtooth (Scaled) from the pull-down menu.
6. Place a checkmark in the Dont use waveform names for plot names
checkbox.
7. In the Name text box, delete the current label and change the name of
this plot to Scaled Sawtooth.
8. Click the OK button to apply the current configuration and close the
Graph Properties dialog box.
Notice how the plot color on the front panel changes.
9. Experiment with other properties of the graph by using the Graph
Properties dialog box. For example, try disabling the autoscale feature
located on the Scales tab.
12
ni.com
10. Click the Cancel button to avoid applying the changes you made while
experimenting. If you want to keep the changes you made, click the OK
button.
11. Save and close the VI.
13
14
ni.com
15
Opening a Blank VI
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.
1. In the 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.
2. If the Functions palette is not visible, right-click any blank space on the
block diagram to display the Functions palette. Click the thumbtack,
shown at left, in the upper left corner of the Functions palette to place
the palette on the screen.
You can right-click a blank space on the block diagram or the front panel to display
the Functions or Controls palettes.
Note
16
ni.com
17
3. To begin the search, press the <Enter> key or click the List Topics
button.
4. Double-click the Sample Compression topic to display the topic that
describes the Sample Compression Express VI.
5. After you read the description of the Express VI, click the Place on the
block diagram button to select the Express VI.
6. Move the cursor to the block diagram.
Notice how LabVIEW attaches the Sample Compression Express VI to
the cursor.
7. Place the Sample Compression Express VI on the block diagram to the
right of the Simulate Signal Express VI.
8. Configure the Sample Compression Express VI to reduce the signal by
a factor of 25 using the mean of these values.
9. Close the Configure Sample Compression dialog box.
10. Using the Wiring tool, wire the Sine output in the Simulate Signal
Express VI to the Signals input in the Sample Compression Express VI.
18
ni.com
6. Arrange the objects on the block diagram so that they appear similar to
the following figure.
You can right-click any wire and select Clean Up Wire from the shortcut menu to
automatically route an existing wire.
Tip
19
4. Click and drag the cursor diagonally to enclose all the Express VIs and
wires, as shown the following figure.
Notice that the While Loop, shown at left, appears with a STOP button
wired to the condition terminal. This While Loop is configured to stop
when the user clicks the STOP button.
5. Display the front panel and run the VI.
Notice that the VI now runs until you click the STOP button. A While
Loop executes the functions inside the loop until the user presses the
STOP button. Refer to Lesson 3, Loops and Charts for more
information about While Loops.
20
ni.com
6. Click the 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.
7. Click the STOP button to stop the VI.
21
22
ni.com
Front Panel
1. Select FileOpen and navigate to C:\Exercises\LV Basics I to
open the Debug Exercise (Main) VI.
The following front panel appears.
Notice the Run button on the toolbar appears broken, shown at left,
indicating that the VI is broken and cannot run.
Block Diagram
2. Select WindowShow Block Diagram to display the following block
diagram.
23
Run the VI
6. Click the Run button to run the VI several times.
7. Select WindowShow Block Diagram to display the block diagram.
8. Animate the flow of data through the block diagram.
a. Click the Highlight Execution button, shown at left, on the toolbar
to enable execution highlighting.
b. Click the Step Into button, shown at left, to start single-stepping.
Execution highlighting shows the movement of data on the block
diagram from one node to another using bubbles that move along the
wires. Nodes blink to indicate they are ready to execute.
c. Click the Step Over button, shown at left, after each node to step
through the entire block diagram. Each time you click the Step Over
button, the current node executes and pauses at the next node.
Data appear on the front panel as you step through the VI. The VI
generates a random number and multiplies it by 10.0. The subVI
adds 100.0 and takes the square root of the result.
d. When a blinking border surrounds the entire block diagram, click the
Step Out button, shown at left, to stop single-stepping through the
Debug Exercise (Main) VI.
9. Single-step through the VI and its subVI.
a. Click the Step Into button to start single-stepping.
b. When the Debug Exercise (Sub) VI blinks, click the Step Into
button. Notice the run button on the subVI.
24
ni.com
25