LabVIEW Basics
Option 3: Open additional copy (see Figure 2.46)
• A new VI (copy of original) is created, stored on the hard drive, and made available for editing.
• The original file is still available for editing.
Option 3 is useful when you need to create a new VI that is similar to the original VI, and will need to continue to edit both.
2.9 CLOSING A VI
You can close the window containing either the front panel or the block diagram by using the Close button at the top-right corner of the window, or the menu options File / Close.
• Closing the front panel automatically closes the block diagram as well.
• Closing the block diagram does not cause the front panel to close.
You can close all open LabVIEW files with File / Close All.
LabVIEW will display a warning (Figure 2.47) if you attempt to close a file that has not been saved, and give you a chance to save the changes before closing.
Original VI New VI Hard Drive
Open Additional Copy
Orig. VI New VI
Figure 2.46
Save As: Create Additional Copy.
Figure 2.47
LabVIEW warning to save changes before closing a file.
This chapter introduced the basics of working with LabVIEW; there will be many opportunities to practice in the following chapters.
KEY TERMS boolean (TF) data type
• Start Menu/All Programs/National Instruments LabVIEW Getting Started window
• provides quick access to information about LabVIEW
• allows you to create a new VI or project
• allows you to open a recently used VI or project LabVIEW Nomenclature
• VI stands for virtual instrument, a LabVIEW program
• front panel—graphical user interface
• block diagram—contains the programming elements
• a project is a collection of related program elements Creating a VI—Basic Approach
1. create a blank VI
2. add controls and indicators to the front panel 3. wire the nodes on the block diagram
4. save the VI with a descriptive name 5. run and test the VI.
LabVIEW Palettes
• Controls Palette—controls and indicators for the front panel
• Functions Palette—functions and programming structures for the block diagram
• Tools Palette—rarely used, allows you to select tools for operating controls, wiring, etc. Automatic tool selection eliminates the need to select tools in most cases
Wiring Terminals
The mouse icon changes to a spool of wire when positioned over a terminal (or near an existing wire) to indicate that wiring is possible.
• Drag the mouse from the output terminal to the input terminal (or vice versa).
Run Button Icons
The Run Button icon shows the status of the VI. The three possible status options are shown in Figure 2.48.
Summary 53
A While Loop from the Express Group on the Functions Palette is often drawn around all controls on the block diagram. When the VI is run, the While Loop will keep the VI running until the STOP button is clicked.
Alternatively,you can also use the Run Continuously button, just to the right of the Run button to keep the VI running.
Saving a VI
Use menu options File / Save, or File / Save As . . . Save As . . . Options
• Substitute copy for original—when you want to start with an existing VI and modify it for a new application.
• Create unopened disk copy—when you want to create periodic backups.
• Open additional copy—when you need to create a new VI that is similar to the original VI, and will need to continue to edit both.
Switch Actions
To set a switch action, right-click on the switch and select Mechanical Action from the pop-up menu.
• Switch When Pressed—toggle switches
• Switch When Released—mouse buttons, usually
• Switch Until Released—doorbell buzzer
• Latch When Pressed—like a starting pistol
• Latch When Released
• Latch Until Released—behaves like the doorbell buzzer Printing a VI
Use menu options File / Print . . . Closing a VI
• Closing the front panel automatically closes the block diagram as well.
• Closing the block diagram does not cause the front panel to close.
Opening a VI
• Double-click on a VI file in a file browser.
• Start LabVIEW (Start / All Programs > / National Instruments LabVIEW) and open the VI file from the LabVIEW environment.
The VI block diagram does not open by default, but can be opened from the front panel using the menu options Window / Show Block Diagram.
Lists of recently edited VIs are available
• On the Getting Started menu
• From the File menu: File / Recent Files LabVIEW Math Functions (partial sample)
• Basic Math Functions
• Add, Subtract, Multiply, Divide
• Increment, Decrement
• Absolute Value
• Square, Square Root
• Reciprocal
• Trig and Hyperbolic Trig Functions
• Log and Exponential Functions
• Matrix Functions
• Optimization Functions
• Differential Equations Functions Dataflow Programming
A node (or block) on a block diagram executes as soon as all of the inputs have values
Data Types
Symbol Data type Color Range Default value Comment
DBL Double-precision floating point numeric
Orange 4.94e–324 to 1.79e1308
0.0 Default data type for
floating point numeric
0 Default data type for
integer numeric values.
TF Boolean Green True or False False
[DBL] Matrix of double-precision numbers
Brackets indicate array or matrix. Color indicates data type of matrix elements. Wires carrying matrices are displayed with thick lines.
abc String Magenta Empty string
Path Gray Empty path Holds a file path.
128-bit (64.64)
Cluster Clusters are collections
of multiple data types.
Waveform Brown Holds the start time, time
step, and data of a waveform.
Wires carrying waveforms are displayed with thick lines.
Self-Assessment 55
S E L F - A S S E S S M E N T