• No results found

PRACTICE: USING A MOMENTARY “ON” SWITCH

In document Labview Engineers (Page 36-41)

Replace the toggle switch with a pushbutton and set the mechanical action to

“Switch Until Released”. Run the VI continuously to observe how the pushbutton now lights the LED only when it is being pressed.

• Pushbutton Control: Controls Palette / Express Group / Buttons Group / Pushbutton

• Change Mechanical Action: Right-click on pushbutton (see Figure 1.21), then select Mechanical Action / Switch Until Released

Solution: Once the mechanical action has been changed to “Switch Until Released”, the LED will light only while the pushbutton is pressed (as illustrated in Figure 1.25).

Figure 1.25

Using a pushbutton with the action set to “Switch Until Released”.

1.7 LABVIEW MENUS

We conclude this chapter with a brief look at the LabVIEW menus to begin to develop a sense of how to accomplish particular tasks and to see what LabVIEW can do. The following is not a complete list of LabVIEW menu options, but a selected list of useful features.

1.7.1 File Menu

The File menu contains options that will look very familiar to most people, plus a few LabVIEW-specific options.

• New VI Opens a new, blank VI.

• Open . . . Opens the Select a File to Open dialog to allow you to find an existing VI for editing or running.

• Close Closes the VI being edited. If the VI has not been saved, you will be asked if you want to save the file before closing (see Figure 1.26).

Figure 1.26

LabVIEW will prompt to save a VI before closing the file.

• Close All Closes all open VIs. If any VIs have been changed, LabVIEW will prompt you to save the file(s) before closing.

• Save Saves the current VI. The first time a VI is saved, you will be asked to give it a file name.

• Save As . . . Opens the Save As dialog that gives several save options.

• Save All Saves all open VIs.

• Save for Previous Version . . . Opens the Save for Previous Version dialog that allows you to select the desired version of LabVIEW (e.g., 2009, 8.6, 8.5, . . . ).

• Revert . . . Discards all changes made since the VI was last saved.

• New Project Creates a new LabVIEW project (collection of related VIs and associated files).

• Print . . . Opens the Print dialog.

• VI Properties Opens the VI Properties dialog (see Figure 1.27) to allow you to observe and set a variety of property values.

Figure 1.27 VI Properties dialog, General category.

• Recent Files Opens a menu listing the most recently edited VIs.

• Exit Shuts down LabVIEW. If there are unsaved VIs, you will be prompted to save them before exiting.

1.7.2 Edit Menu

The Edit menu collects menu options related to making various changes to the VI.

• Undo Reverses the last editing action. You can use the option repeatedly to back out of a series of edit steps.

• Redo Reapplies an edit step that was undone.

• Cut Copies an object to the Windows clipboard and removes the object from the VI.

• Copy Copies an object to the Windows clipboard and leaves the object in the VI.

• Paste Pastes an object previously copied to the Windows clipboard into the VI.

• Select All Selects all objects. Useful for moving all existing objects to make space for something new.

• Make Current Values Default Any values that are entered into controls in an edit session will be lost when the VI is saved and reloaded unless the values are made the default values for the control. This menu option is used to make all val-ues currently in controls the default valval-ues for the controls.

• Reinitialize Values to Defaults Resets values in controls back to the default values.

• Remove Broken Wires Removes all broken wires on the block diagram. Ctrl-B is the keyboard shortcut.

Section 1.7 LabVIEW Menus 23

• Create VI Snippet from Selection A snippet is a piece of program code that you want to reuse. This menu option allows you to select a section of a VI and save it for reuse in the future.

• Create SubVI A SubVI is a VI that will be used within another VI. It is easy to cre-ate a SubVI by selecting a group of program elements and using this menu option.

1.7.3 View Menu

The View menu provides access to various palettes and windows.

• Controls Palette Toggles the display of the Controls Palette. Only active from the front panel.

• Functions Palette Toggles the display of the Functions Palette. Only active from the block diagram.

• Tools Palette Toggles the display of the Tools Palette.

• Quick Drop Opens the Quick Drop dialog, which is used to quickly locate func-tions and controls by name.

• Breakpoint Manager Opens the Breakpoint Manager dialog to allow you to enable, disable, and delete breakpoints.

• Probe Watch Window Opens the Probe Watch Window, which can be used to monitor the values of all probes on a block diagram.

• Error List Opens the Error List window, which lists all errors that are prevent-ing the VI from runnprevent-ing. The Error List is also displayed when you click the Broken Run button.

• Getting Started Window Opens the Getting Started Window.

1.7.4 Project Menu

The Project menu is used to manage LabVIEW projects. A LabVIEW project is a col-lection of related VIs and associated files. Keeping related files collected makes creating a complex program easier, and simplifies creating a run-time version of the program.

• New Project Creates a new (empty) LabVIEW project.

• Open Project . . . Opens an existing LabVIEW project selected using a dialog.

• Save Project Saves the current LabVIEW project.

• Close Project Closes the current LabVIEW project.

• Add to Project > Allows you to add a file to an open project.

1.7.5 Operate Menu

The Operate menu allows you to control how a VI runs.

• Run Starts the VI. Equivalent to clicking the Run button on the front panel or block diagram window.

• Stop Stops a running VI. Equivalent to clicking the Abort Execution button on the front panel or block diagram window.

• Step Into Starts the VI, but runs only the first step of the VI. Use Step Over to continue step by step and Step Out to finish program execution.

1.7.6 Tools Menu

The Tools menu offers some fairly advanced options, only a few are mentioned here.

• Measurement & Automation Explorer The Measurement & Automation Explorer is used to keep track of the various data acquisition devices on a com-puter, and to create data acquisition tasks.

• Build Application (EXE) from VI . . . Used to create a standalone application that can run outside of LabVIEW.

• Options . . . Provides access to the default options used by LabVIEW.

1.7.7 Window Menu

The Window menu is used to control the way the LabVIEW windows are dis-played. The bottom section of the Window menu shows a menu of all currently open LabVIEW windows. This allows you to access any open LabVIEW window from any other.

• Show Block Diagram Available from the Front Panel, the Show Block Diagram option displays the block diagram associated with the current front panel.

• Show Front Panel Available from the Block Diagram, the Show Front Panel option displays the front panel associated with the current block diagram.

• Show Project Displays the project window associated with the current VI (if any).

• Tile Left and Right Fills the screen with the front panel and block diagram side by side.

• Tile Up and Down Fills the screen with the front panel and block diagram one over the other.

• Full Size Expands the current window to the full screen size.

1.7.8 Help Menu

The Help menu provides access to the LabVIEW Help system.

• Show Context Help Opens a small Context Help window (see Figure 1.28), which provides a brief description for any object that the mouse hovers over.

Most descriptions include a link to more detailed Help information.

• Search the LabVIEW Help . . . Opens the full LabVIEW Help system.

KEY TERMS Automatic Tool Selection Automatic Tool descriptions and a link to additional information.

Self-Assessment 25

LabVIEW—software for data acquisition and analysis VI—a LabVIEW computer program

Front Panel—the graphical user interface—holds controls Block Diagram—the graphical program—holds functions Controls Palette

The Controls Palette contains the switches, knobs, dials, and indicators that are used to set and display values on the front panel.

Functions Palette

The Functions Palette contains:

• Functions (pale yellow background)

• VIs (pale yellow strip across the top of the icon, or yellow border when expanded and “.vi” in the name)

• Express VIs (a blue strip across the top of the icon, or blue border when expanded)

S U M M A R Y

1. What is LabVIEW designed to accomplish?

ANS: LabVIEW may originally have been designed to make data acquisition with National instruments hardware easier, but LabVIEW is a full-fledged programming language and math application in its own right.

2. The user (as opposed to the programmer) of a virtual instrument primarily uses which part of the virtual instrument?

a. Front Panel b. Block Diagram

ANS: The front panel is the graphical interface used by the user.

3. If you wanted to add a virtual on–off switch to a virtual instrument, the switches would be found on which palette?

a. Functions Palette b. Controls Palette

ANS: Switches are controls that are found on the Controls Palette and placed on the front panel.

4. If you wanted to add a virtual on–off switch to a virtual instrument, where would the control be placed?

a. Front Panel b. Block Diagram

ANS: Switches are controls that are found on the Controls Palette and placed on the front panel.

5. If you had developed a LabVIEW program that created a data set, and you wanted to create a graph, where would the graph be placed?

a. Front Panel b. Block Diagram ANS: On the front panel.

S E L F - A S S E S S M E N T

In document Labview Engineers (Page 36-41)