0% found this document useful (0 votes)
99 views23 pages

This Chapter Introduces The Course Map and The Basics of Labview

This chapter introduces LabVIEW, including what a virtual instrument (VI) is, the LabVIEW environment and interface, and the main components of a VI. It discusses that LabVIEW uses graphical programming to create VIs that can acquire and analyze data. VIs have a front panel interface and a block diagram program. The chapter reviews the LabVIEW windows, menus, tools, and palettes and how they allow creating and debugging VIs in a graphical environment.

Uploaded by

Horatiu Belei
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views23 pages

This Chapter Introduces The Course Map and The Basics of Labview

This chapter introduces LabVIEW, including what a virtual instrument (VI) is, the LabVIEW environment and interface, and the main components of a VI. It discusses that LabVIEW uses graphical programming to create VIs that can acquire and analyze data. VIs have a front panel interface and a block diagram program. The chapter reviews the LabVIEW windows, menus, tools, and palettes and how they allow creating and debugging VIs in a graphical environment.

Uploaded by

Horatiu Belei
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter 1 Introduction to LabVIEW Chapter 1 Introduction to LabVIEW This chapter introduces the course map and the basics

s of LabVIEW.

Chapter 1 Introduction to LabVIEW

Introduction to LabVIEW

Creating, Editing and Debugging a VI

Creating a SubVI

Loops and Charts

Arrays and Graphs

Case and Sequence Structures

Strings and File I/O

VI Customization

Data Acquisition

Instrument Control

Chapter 1 Introduction to LabVIEW You Will Learn: A. What a virtual instrument (VI) is. B. About the LabVIEW environment (windows, menus, and tools). C. About the LabVIEW help options. A. Virtual Instruments LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is a powerful instrumentation and analysis programming language. LabVIEW departs from the sequential nature of traditional programming languages and features a graphical programming environment and all the tools needed for data acquisition, analysis, and presentation. With this graphical programming language, called G, you can program in a block diagram notation, the natural design notation of scientists and engineers. After you create a block diagram program, LabVIEW compiles it into machine code. LabVIEW integrates data acquisition, analysis, and presentation in one system. For acquiring data and controlling instruments, LabVIEW supports RS-232/422, IEEE 488 (GPIB), and VXI, including Virtual Instrument Software Architecture (VISA) functions, as well as plug-in data acquisition (DAQ) boards. An instrument library with drivers for hundreds of instruments simplifies instrument control applications. For analyzing data, the extensive Analysis library contains functions for signal generation, signal processing, filters, windows, statistics, regression, linear algebra, and array arithmetic. Because LabVIEW is graphical in nature, it is inherently a data presentation package. LabVIEW can generate charts, graphs, and customized, user-defined graphics. LabVIEW programs are called virtual instruments (VIs). VIs have three main parts: the front panel, the block diagram, and the icon/connector. The front panel is your means of setting input values and viewing outputs from the VI block diagram. Because the front panel is analogous to a front panel of a real instrument, the inputs are called controls and the outputs are called indicators. You can use a variety of controls and indicators, such as knobs, switches, buttons, charts, graphs, and so on to make the front panel easily identifiable and understandable. An example of the front panel for a Temperature VI is

shown below. Each front panel has an accompanying block diagram, which is the VI program. You build the block diagram using the graphical programming language G. You can think of the block diagram as source code. The components of the block diagram represent program nodes; for example, For Loops, Case structures, and arithmetic

Chapter 1 Introduction to LabVIEW functions. The components are wired together to define the flow of data within the block diagram. The block diagram for the Temperature VI is shown below.

You use the icon/connector to turn a VI into an object (subVI) that you can use as a subroutine in the block diagrams of other VIs. The icon graphically represents the VI in the block diagram of other VIs. The connector terminals determine where you must wire the inputs and outputs on the icon. The terminals are analogous to subroutine parameters. They correspond to the controls and indicators on the VI front panel. The following illustration shows the icon and connector for the Temperature VI. The connector usually is hidden under the icon until you choose to view it.

The power of LabVIEW lies in the hierarchical nature of the VI. After you create a VI, you can use it as a subVI in the block diagram of a higher-level VI. There is no limit on the number of layers in the hierarchy. As an example, look at a VI that uses the Temperature VI as a subVI in its block diagram. The front panel of the top-level VI is shown below. The Temperature VI, used as a subVI, collects data, and then the top-level VI graphs the results. You specify the number of measurements and the delay between each measurement on the top-level VI front panel.

Chapter 1 Introduction to LabVIEW

The top-level VI block diagram shows the Temperature VI in a loop. The VI collects the measurement during each loop iteration. After the loop executes a specified number of times, the VI passes the data to an icon that graphs it on the front panel of the top-level VI. With LabVIEW, you can use a VI as a subVI. This feature makes your blockdiagrams modular and easy to debug, understand, and maintain. B. The LabVIEW Environment The LabVIEW system consists of the LabVIEW application and several associated files. In the Windows environment, the LabVIEW group window/menu contains icons. The LabVIEW program icon starts LabVIEW program operation. The LabVIEW Uninstall icon starts the uninstall utility to remove LabVIEW and its associated files from your computer. In addition, the LabVIEW installer automatically installs the NI-DAQ support and configuration files into the LabVIEW Program Group. Front panels and block diagrams consist of collections of graphical objects, which are LabVIEW programming elements. Front panels contain various types of controls and indicators. Block diagrams contain terminals corresponding to front panel controls and indicators, as well as constants, functions, subVIs, structures, and wires that carry data from one object to another. The following illustration shows a front panel and its associated block diagram.

Chapter 1 Introduction to LabVIEW

Front Panel Toolbar Both the Panel and Diagram windows contain a toolbar of command buttons and status indicators that you use for controlling the VI. One of two toolbars is available, depending on whether you are working in the Panel or Diagram window. The following toolbar appears at the top of the Panel window.

Chapter 1 Introduction to LabVIEW

Block Diagram Toolbar The block diagram toolbar contains most of the same buttons as the front panel toolbar, in addition to four debugging features.

Chapter 1 Introduction to LabVIEW

Pop-Up Menus The LabVIEW menu you use most often is the pop-up menu. Nearly all the objects you use to build VIs have pop-up menus for selection and modification. In this manual, the action of accessing a pop-up menu is known as popping up. Pull-Down Menus The menu bar at the top the LabVIEW screen contains several pull-down menus. The pull-down menus contain options common to most applications, such as Open, Save, Copy, and Paste, as well as many others particular to LabVIEW.

You use options in the File menu primarily to open, close, save, and print VIs.

Chapter 1 Introduction to LabVIEW

You use the options in the Edit menu to modify front panel and block diagram objects of a VI. You use these options to manipulate and arrange LabVIEW components to your personal taste.

You use the commands in the Operate menu to execute the VI.

Chapter 1 Introduction to LabVIEW You use the Projects menu to obtain additional information regarding the VI, its subVIs, and windows.

You use the Windows menu to locate opened windows quickly and to open windows of subVIs and calling VIs.

You use the Help menu to view information about panel or diagram objects, to activate the online reference utilities, and to view information about your LabVIEW version number and computer memory.

10

Chapter 1 Introduction to LabVIEW

Palettes LabVIEW has graphical, floating palettes to aid in creating and operating VIs. The three palettes include the Tools, Controls, and Functions palettes. Tools Palette You can create, modify, and debug VIs using the tools located in the floating Tools palette. If the Tools palette is not visible, select Show Tools Palette from the Windows menu to display the palette. After you select a tool from this menu, the mouse cursor takes its shape. (WindowsYou also can access the Tools palette by pressing <shift> and the right mouse button.

11

Chapter 1 Introduction to LabVIEW

Controls and Functions Palettes The Controls and Functions palettes consist of top-level icons representing subpalettes, giving access to a full range of available objects that you can use in creating a VI. You can access the subpalettes by clicking on the top-level icon. You also can convert the subpalette to a floating palette that remains on your screen by tacking down the thumbtack at top left corner of the subpalette. Controls Palette You add controls and indicators to the front panel via the Controls palette. Each option in the palette displays a subpalette of available controls and indicators for that selection. If the Controls palette is not visible, you can open the palette by selecting Show Controls Palette from the Windows menu. You also can access the Controls palette by popping up on an open area in the Panel window. Then you can tack down the Controls

12

Chapter 1 Introduction to LabVIEW palette into a floating palette by clicking on the pushpin on the top left corner of the palette. The Controls palette is available only when the Panel window is active.

13

Chapter 1 Introduction to LabVIEW Functions Palette You build the block diagram with the Functions palette. Each option in the palette displays a subpalette of top-level icons. If the Functions palette is not visible, you can open the palette by selecting Show Functions Palette from the Windows menu. You access the Functions palette by popping up on an open area in the Diagram window. Then you can convert the Functions palette to a floating palette by clicking on the pushpin. The Functions palette is available only when the Diagram window is active.

14

Chapter 1 Introduction to LabVIEW

15

Chapter 1 Introduction to LabVIEW

VI Libraries You can load and save VIs to/from a special file called a VI library (normally a file with the .llb extension). Advantages to using VI libraries include: With VI libraries, you can use up to 255 characters to name your VIs, including the .vi extension. VI libraries compress VIs to save disk space (they are decompressed at load time). Because multiple VIs are in a single file, it is easier to transfer VIs between computers. Other VI library characteristics include: VI libraries are not hierarchal in nature. That is, you cannot create a VI library within another VI library. Saving and loading VIs to and from the file system is faster than to and from VI libraries. You load a VI into memory by choosing the Open option from the File menu. When you choose that option, a dialog box similar to the one below appears.

16

Chapter 1 Introduction to LabVIEW VI libraries and VIs appear in the dialog box next to a representative symbol. After you create a VI library, it appears in the File dialog boxes as a folder with a VI in the folder icon. A regular directory appears as a folder without the VI. In the figure below, BASICS.LLB is a VI library and examples is a directory.

You can open a VI library or directory by clicking on it and then on OK, or by doubleclicking on it. You will notice that the LabVIEW file dialog box opens VI libraries as if they are directories. After you locate your VI, you can load it by clicking on it and then on OK, or by double-clicking on it. As the VI loads, the following status dialog box appears on the screen.

The Loading field lists the subVIs of your VI as they are loaded into memory. Number Loaded is the number of subVIs loaded into memory so far. You can cancel the load at any time by clicking on Stop. If LabVIEW cannot immediately locate a subVI, it begins searching through all directories specified by the VI Search Path (Edit menu Preferences Paths). The Searching field lists directories or VIs as LabVIEW searches through them. At this point, you can have LabVIEW ignore the subVI by clicking on Ignore SubVI, or you can click on Browse to search for the missing subVI using a file dialog box. You can save your VI to a regular directory or VI library by selecting Save, Save As..., or Save a Copy As... from the File menu to save the VI to a regular directory or VI library. To create a new VI library, select the Save As... option from the File menu and click on the New VI Library button from the Save As... dialog box. After clicking on the New VI Library or New button, one of the following dialog boxes appears:

17

Chapter 1 Introduction to LabVIEW

Enter the name of the new library in the dialog box and click on the VI Library button. LabVIEW appends the .llb extension if you do not include it. VI libraries have the same load, save, and open capabilities as folders or directories while in the LabVIEW environment. You can remove VIs from a VI library by using the Edit VI Library option of the File menu or the File Manager option from the Project menu if you have the Professional Edition of LabVIEW.

Exercise 1-1 Frequency Response.vi 1.You can open it by selecting Open VI LabVIEW Examples Apps freqresp.llb Frequency Response.vi. 2. Click on Frequency Response.vi.

18

Chapter 1 Introduction to LabVIEW

19

Chapter 1 Introduction to LabVIEW Block Diagram

1. Show the block diagram for the Frequency Response VI by selecting Show Diagram from the Windows menu. 2. This diagram contains several of the basic elements of LabVIEW programming including structures, functions, and subVIs. You will learn about all these in detail later in this course. 3. Using the Operating tool, double-click on the DMM icon as shown below.

This icon is a subVI called Demo Fluke 8840A.vi. After you double-click on it, that subVIs front panel opens.

4. This panel was designed to look just like a multimeter user interface. Now you can see why LabVIEW programs are called virtual instruments. You can also see that by making LabVIEW applications modular, they have reusable parts that can be easily modified or used elsewhere. For example, this subVI just simulates the action of a Fluke multimeter, but you can modify this VI to do actual instrument control later. 5. Close the front panel for the Demo Fluke 8840A VI by selecting Close from the File menu. 6. Do not close the Frequency Response VI, as you will use it in the next exercise.

20

Chapter 1 Introduction to LabVIEW C. LabVIEW Help Options LabVIEW has various Help options for VIs, subVIs, and nodes. The two common options used for LabVIEW programming include the Help Window and the Online Help feature. Help Window To display the Help Window, choose Show Help from the Help menu or press <ctrl-H>. When you place one of the tools from the Tools palette on diagram and panel objects, the Help window shows the icon for subVIs, functions, constants, controls and indicators, and dialog box options with wires attached to each terminal. In the window, required terminals are labeled in bold, recommended connections in plain text, and optional connections are gray. The example below displays a Help Window in Simple Diagram mode.

21

Chapter 1 Introduction to LabVIEW

Online Help Online Help features detailed descriptions of most block diagram objects. You can access Online Help either by clicking on the Online Help icon in the Help window or choosing Online Reference... from the Help menu. Exercise 1-2 To use LabVIEW Help utilities. You will use various LabVIEW Online Help Window and Help Window options to read about front panel and block diagram objects and features. Part A 1. The Frequency Response VI should still be open from the first exercise. If not, open it as described in Exercise 1-1. 2. Open the online reference by selecting Online Reference... from the Help menu.

22

Chapter 1 Introduction to LabVIEW 3. When the reference menu opens, choose G Programming Language Block Diagram Programming from the Reference column. 4. From the Block Diagram Programming screen, select Introduction to the Block Diagram. 5. Read the overview of terminals and nodes. 6. Close the online reference by choosing Exit or Quit from the File menu. 7. Activate the Diagram window by selecting Show Diagram from the Windows menu or pressing <ctrl-E>. 8. Display the Help Window either by selecting Show Help from the Help menu or pressing <ctrl-H>. 9. You will see how the Help Window displays information regarding the functions and wires over which the tools pass.

10. Close the Help Window by pressing <ctrl-H>. 11. Go to the Panel Window and close the Frequency Response VI by selecting Close from the File menu. Do not save any changes.

23

You might also like