Skip to main content

Chapter 1(a): Getting Started with LabVIEW 2013

CHAPTER 1

Getting Started with LabVIEW

Virtual Instruments

 

LabVIEW programs are called virtual instruments, or VIs, because
their appearance and operation imitate physical instruments, such as
oscilloscopes and multimeters. LabVIEW contains a comprehensive set of tools for acquiring, analyzing, displaying, and storing data, as well as tools to help you troubleshoot code you write.


In LabVIEW, you build a user interface, or front panel, with controls and indicators. Controls are knobs, push buttons, dials, and other input mechanisms. Indicators are graphs, LEDs, and other output displays. After you build the front panel, you add code using VIs and structures to control the front panel objects. The block diagram contains this code.


You can use LabVIEW to communicate with hardware such as data
acquisition, vision, and motion control devices, as well as GPIB, PXI, VXI, RS232, and RS485 instruments.



Building the Virtual Instrument

In the following exercises, you will build a VI that generates a signal and displays that signal in a graph. After you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 1-1.


Launching LabVIEW 


The LabVIEW window, shown in Figure 1-2, appears when you
launch LabVIEW. Use this window to create new VIs, select among the
most recently opened LabVIEW files, find examples, and launch the
LabVIEW Help. You also can access information and resources to help
you learn about LabVIEW, such as specific manuals, help topics, and
resources on the National Instruments Web site, ni.com.




Figure 1.2 LabVIEW Window


The LabVIEW window disappears when you open an existing file or create a new file. The Getting Started window reappears when you close all open front panels and block diagrams. You also can display the window from the front panel or block diagram by selecting View»Getting Started Window.



Opening a New VI from a Template


LabVIEW provides built-in template VIs that include the subVIs,
functions, structures, and front panel objects you need to get started building common measurement applications.




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

1. Launch LabVIEW.
 
2. In the LabVIEW window, click the New or VI from Templatelink to display the New dialog box.


3. From the Create New list, select VI»From Template»Tutorial
(Getting Started)»Generate and Display.
This template VI
generates and displays a signal.
A preview and a brief description of the template VI appear in the
Description section. Figure 1-3 shows the New dialog box and the
preview of the Generate and Display template VI.





Figure 1.3 New Dialog box



4. Click the OK button to create a VI from the template. You also can double-click the name of the template VI in the Create New list to create a VI from a template.
LabVIEW displays two windows: the front panel window and the
block diagram window.


5. Examine the front panel window.
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. You also can switch between the front panel window and block diagram window at any time by pressing the keys. The key in
keyboard shortcuts corresponds to the (Mac OS X)














6. Select Window»Show Block Diagram and 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.

 
7. On the front panel toolbar, click the Run button, shown at left. You also can press the keys to run a VI.
A sine wave appears on the graph in the front panel window.




  8. Stop the VI by clicking the front panel STOP button, shown at left.




Adding a Control to the Front Panel


Front panel controls simulate the input mechanisms 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 keys.



1. If the Controls palette, shown in Figure 1-4, is not visible in the front panel window, select View»Controls Palette.



💡 Tip: You can right-click any blank space in the front panel or the block diagram to display a temporary version of the Controls or Functions palette. The Controls or Functions palette appears with a thumbtack icon in the upper left corner. Click the thumbtack to pin
the palette so it is no longer temporary.



2. If you are a new LabVIEW user, the Controls palette opens with the Express palette, shown in Figure 1-4, visible by default. If you do not see the Express palette, click Express on the Controls palette to display the Express palette.



Figure 1.4  Control Palette



3. Move the cursor over the icons on the Express palette to locate the Numeric Controls palette.
When you move the cursor over icons on the Controls palette, the
name of the subpalette, control, or indicator appears in a tip strip below the icon.




📌 Note: Some palette objects display a short name on the palette that is different from the name that appears in the tip strip. The short name abbreviates the name of the palette object so that it fits in the space available on the palette. If you have difficulty finding a palette object by its short name, use the Search button on the Controls or Functions palette to find the palette object by name.




4. Click the Numeric Controls icon to display the Numeric Controls
palette.


5. Click the Knob control on the Numeric Controls palette to attach the control to the cursor, and then add the knob to 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.


6. Select File»Save As and save the VI as Acquiring a Signal.vi in
an easily accessible location.






Comments