Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » LabVIEW Graphical Programming » Acquiring a Signal VI

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection: "LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • eScience, eResearch and Computational Problem Solving

    This module is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. OdegardAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Acquiring a Signal VI

Module by: National Instruments. E-mail the author

Summary: Explore the LabVIEW enviroment by creating a VI that generates a signal and displays it on the front panel.

Exercise 1

In the following exercise, you will build a VI that generates a signal and displays that signal in a graph. LabVIEW provides templates containing information from which you can build a VI. These templates help you get started with LabVIEW.

Complete the following steps to create a VI that generates a signal and displays it on the front panel.

  1. Launch LabVIEW.
  2. In the LabVIEW dialog box that appears, shown in Figure 1, click the New button to display the New dialog box.
    Figure 1
    Figure 1 (LabVIEWdialogbox.png)
  3. Select VI from Template>>Tutorial (Getting Started)>>Generate and Display in the Create new list. This template VI generates and displays a signal. Notice that previews of the template VI appear in the Front panel preview and the Block diagram preview sections. The Figure 2 shows the New dialog box and the Generate and Display template VI.
    Figure 2
    Figure 2 (newdialogbox.png)
  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.

    note:

    If the front panel is not visible, you can display the front panel by selecting Window>>Show Front Panel.
  6. Examine the block diagram of the VI. The block diagram appears with a white background and includes VIs and structures that control the front panel objects. The title bar of the block diagram indicates that this window is the block diagram for the Generate and Display VI.

    note:

    If the block diagram is not visible, you can display the block diagram by selecting Window>>Show Block Diagram.
  7. run.png On the front panel toolbar, click the Run button, shown at left. Notice that a sine wave appears on the graph.
  8. stopbutton.png Stop the VI by clicking the Stop button, shown at left, on the front panel.

1.a) Adding a Control to the Front Panel

Controls on the front panel simulate the input devices on a physical instrument and supply data to the block diagram of the VI. Many physical instruments have knobs you can turn to change an input value. Complete the following steps to add a knob control to the front panel.

Tip:

Throughout these exercises, you can undo recent edits by selecting Edit>>Undo or pressing the Ctrl-Z keys.
  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 File>>Save As and save this VI as Acquiring a Signal.vi in the C:\Exercises\LabVIEW Basics I directory.

    note:

    Save all the VIs you edit or create in this course in the C:\Exercises\LabVIEW Basics I directory.

1.b) Changing the Signal Type

The block diagram has a blue icon labeled Simulate Signal. This icon represents the Simulate Signal Express VI. The Simulate Signal Express VI simulates a sine wave by default. Complete the following steps to change this signal to a sawtooth wave.

  1. Display the block diagram by selecting Window>>Show Block Diagram or by clicking the block diagram. simulatesignalexpVI.png Notice the Simulate Signal Express VI, shown in Media 5. An Express VI is a component of the block diagram that you can configure to perform common measurement tasks. The Simulate Signal Express VI simulates a signal based on the configuration that you specify.
  2. Right-click the Simulate Signal Express VI and select Properties from the shortcut menu to display the Configure Simulate Signal dialog box.
  3. Select Sawtooth from the Signal type pull-down menu. Notice that the waveform on the graph in the Result Preview section changes to a sawtooth wave. The Configure Simulate Signal dialog box should appear similar to Figure 3.
    Figure 3
    Figure 3 (configuresimulatesignal.png)
  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. expandVI.png 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 Figure 3, 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.

1.c) Wiring Objects on the Block Diagram

To use the knob control to change the amplitude of the signal, you must connect the two objects on the block diagram. Complete the following steps to wire the knob to the Amplitude input on the Simulate Signal Express VI.

  1. iconterminal.png Move the cursor over the Knob terminal, shown at left, until the Positioning tool appears. position.png Notice how the cursor becomes an arrow, or the Positioning tool, shown in Media 9. Use the Positioning tool to select, position, and resize objects.
  2. loop.png Click the Knob terminal to select it, then drag the terminal to the left of the Simulate Signal Express VI. Make sure the Knob terminal is inside the loop, shown in Media 10. The terminals are representations of front panel controls and indicators. Terminals are entry and exit ports that exchange information between the front panel and block diagram.
  3. Deselect the Knob terminal by clicking a blank space on the block diagram.
  4. iconterminal.png Move the cursor over the arrow of the Knob terminal, shown in Media 11. wiring.png Notice how the cursor becomes a wire spool, or the Wiring tool, shown at left. Use the Wiring tool to wire objects together on the block diagram.

    note:

    The cursor does not switch to another tool while an object is selected.
  5. ampwiring.png When the Wiring tool appears, click the arrow and then click the Amplitude input of the Simulate Signal Express VI, shown in Media 13, 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 File>>Save to save this VI.

1.d) 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 Window>>Show Front Panel or by clicking the front panel.

    Tip:

    Press the Ctrl-E keys to switch from the front panel to the block diagram or from the block diagram to the front panel.
  2. Click the Run button.
  3. Move the cursor over the knob control. operate.png Notice how the cursor becomes a hand, or the Operating tool, shown at left. Use the Operating tool to change the value of a control or select the text within a control.
  4. Using the Operating tool, turn the knob to adjust the amplitude of the sawtooth wave. Notice how the amplitude of the sawtooth wave changes as you turn the knob. Also notice that the y-axis on the graph autoscales to account for the change in amplitude. runtop.png To indicate that the VI is running, the Run button changes to a darkened arrow, shown at left. You cannot edit the front panel or block diagram while the VI runs.
  5. stopbutton.png Click the Stop button, shown at left, to stop the VI.

note:

Although Abort Execution button looks like a stop button, the Abort Execution button does not always properly close the VI. National Instruments recommends stopping your VIs using the Stop button on the front panel. Use the Abort Execution button only when errors prevent you from terminating the application using the Stop button.

1.e) Modifying the Signal

Complete the following steps to add scaling to the signal and display the results in the graph on the front panel.

  1. selectingawire.png On the block diagram, use the Positioning tool to double-click the wire that connects the Simulate Signal Express VI to the Waveform Graph terminal shown in Media 17.
  2. Press the Delete key to delete this wire.
  3. If the Functions palette is not visible on the block diagram, select Window>>Show Functions Palette to display it.
  4. ScalingandMapping.png Select the Scaling and Mapping Express VI, shown at left, on the Arithmetic & Comparison palette and place it on the block diagram inside the loop between the Simulate Signal Express VI and the Waveform Graph terminal. If there is no room between the Express VI and the terminal, move the Waveform Graph terminal to the right. Notice that the Configure Scaling and Mapping dialog box automatically opens when you place the Express VI on the block diagram.
  5. Define the value of the scaling factor by entering 10 10 in the Slope (m) text box. The Configure Scaling and Mapping dialog box should appear similar to Figure 4.
    Figure 4
    Figure 4 (configurescaling.png)
  6. Click the OK button to apply the current configuration and close the Configure Scaling and Mapping dialog box.
  7. Move the cursor over the arrow on the Sawtooth output of the Simulate Signal Express VI.
  8. simulatewirescale.png 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 in Media 20, 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 Figure 5.
    Figure 5
    Figure 5 (acquiresignalbdnomerge.png)

    note:

    The terminals in the block diagram are set to display as icons. To display a terminal as a data type on the block diagram, right-click the terminal and select View As Icon from the shortcut menu to remove the checkmark.
  10. Select File>>Save to save this VI.

1.f) Displaying Two Signals on the Graph

To compare the signal generated by the Simulate Signal Express VI and the signal modified by the Scaling and Mapping Express VI on the same graph, use the Merge Signals function. Complete the following steps to display two signals on the same graph.

  1. Move the cursor over the arrow on the Sawtooth output of the Simulate Signal Express VI.
  2. Using the Wiring tool, wire the Sawtooth output to the Waveform Graph terminal. mergewires.png The Merge Signals function, shown in Media 22, appears where the two wires connect. This function takes the two separate signals and combines them so that both can be displayed on the same graph. The block diagram should appear similar to Figure 6.
    Figure 6
    Figure 6 (acquiresignalbd.png)
  3. Select File>>Save 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 10 times the knob value. This scaling occurs because you set the slope to 10 10 in the Scaling and Mapping Express VI.
  5. Click the Stop button.

1.g) Customizing the Knob

The knob control changes the amplitude of the sawtooth wave so labeling it Amplitude accurately describes the function of the knob. Complete the following steps to customize the appearance of a control on the front panel.

  1. Right-click the knob and select Properties from the shortcut menu to display the Knob Properties dialog box.
  2. In the Label section on the Appearance tab, delete the label Knob, and type Amplitude in the text box. The Knob Properties dialog box should appear similar to Figure 7.
    Figure 7
    Figure 7 (knobproperties.png)
  3. Click the Scale tab and, in the Scale Range section, change the maximum value to 5.0 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.

    Tip:

    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 Edit>>Undo or pressing the Ctrl-Z keys.
  6. Experiment with other properties of the knob by using the Knob Properties dialog box. For example, try changing the colors for the Marker Text Color by clicking the color box located on the Scale tab.
  7. 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.

1.h) Customizing the Waveform Graph

The waveform graph indicator displays the two signals. To indicate which plot is the scaled signal and which is the simulated signal, you customize the plots. Complete the following steps to customize the appearance of an indicator on the front panel.

  1. Move the cursor over the top of the plot legend on the waveform graph. Notice that while there are two plots on the graph, the plot legend displays only one plot.
  2. When a double-headed arrow appears, shown in Figure 8, click and drag the border of the plot legend until the second plot name appears.
    Figure 8
    Figure 8 (expandplotlegend.png)
  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 Don't 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.
  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 this VI.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks