LabVIEW

TM

Getting Started with LabVIEW
Getting Started with LabVIEW

April 2003 Edition Part Number 323427A-01

Support Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Worldwide Offices Australia 61 2 9672 8846, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599, Canada (Calgary) 403 274 9391, Canada (Montreal) 514 288 5722, Canada (Ottawa) 613 233 5949, Canada (Québec) 514 694 8521, Canada (Toronto) 905 785 0085, Canada (Vancouver) 514 685 7530, China 86 21 6555 7838, Czech Republic 420 2 2423 5774, Denmark 45 45 76 26 00, Finland 385 0 9 725 725 11, France 33 0 1 48 14 24 24, Germany 49 0 89 741 31 30, Greece 30 2 10 42 96 427, Hong Kong 2645 3186, India 91 80 51190000, Israel 972 0 3 6393737, Italy 39 02 413091, Japan 81 3 5472 2970, Korea 82 02 3451 3400, Malaysia 603 9059 6711, Mexico 001 800 010 0793, Netherlands 31 0 348 433 466, New Zealand 64 09 914 0488, Norway 47 0 32 27 73 00, Poland 48 0 22 3390 150, Portugal 351 210 311 210, Russia 7 095 238 7139, Singapore 65 6 226 5886, Slovenia 386 3 425 4200, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 0 8 587 895 00, Switzerland 41 56 200 51 51, Taiwan 886 2 2528 7227, United Kingdom 44 0 1635 523545 For further support information, refer to the Technical Support and Professional Services appendix. To comment on the documentation, send email to techpubs@ni.com. © 2003 National Instruments Corporation. All rights reserved. Austin, Texas 78759-3504 USA Tel: 512 683 0100

Important Information
Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free. A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty. National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it. EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. CUSTOMER’S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owner’s failure to follow the National Instruments installation, operation, or maintenance instructions; owner’s modification of the product; owner’s abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.

Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.

Trademarks
CVI™, DAQPad™, LabVIEW™, Measurement Studio™, National Instruments™, NI™, NI Developer Zone™, ni.com™, NI-DAQ™, and SCXI™ are trademarks of National Instruments Corporation. FireWire® is the trademark of Apple Computer, Inc., registered in the U.S. and other countries. Other product and company names mentioned herein are trademarks or trade names of their respective companies.

Patents
For patents covering National Instruments products, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your CD, or ni.com/patents.

WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS
(1) NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY TO A HUMAN. (2) IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY, COMPUTER HARDWARE MALFUNCTIONS, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILERS AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR MISUSES, OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER (ADVERSE FACTORS SUCH AS THESE ARE HEREAFTER COLLECTIVELY TERMED “SYSTEM FAILURES”). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY AND DEATH) SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID DAMAGE, INJURY, OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS. BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN, PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.

............................................2-4 Analyzing the Amplitude of a Signal ....................................................................................................................................................1-8 Modifying the Signal.........................Contents About This Manual Conventions .....1-7 Running the VI ..............................................1-4 Changing the Signal Type ............................................1-9 Displaying Two Signals on the Graph.................................................................................ix Chapter 1 Getting Started with LabVIEW Virtual Instruments Building a Virtual Instrument .............................................................2-10 Summary ....................................................................................................................................................................................................2-13 LabVIEW Help Resources ..................................................................................................................1-17 Express VIs.......................................2-13 © National Instruments Corporation v Getting Started with LabVIEW ........................................................................................................1-1 Opening a New VI from a Template ....2-1 Opening a New VI from a Template .............2-6 Setting the Warning Level Limit........................................2-10 Saving Data when Prompted by a User............................................2-2 Modifying the Block Diagram..............................................................................................................................2-9 Adding a Button that Stores Data when Pressed ...........................1-16 Property Dialog Boxes ...........1-17 Chapter 2 Analyzing and Saving a Signal Building a VI from a Template.................................................................................................................1-12 Customizing the Waveform Graph...........................................................................................................................................................1-2 Adding a Control to the Front Panel..........................................................1-16 New Dialog Box and VI Templates .......................................2-5 Adding a Warning Light...1-14 Summary ...........................................................................................................................................................................2-9 Saving Data to a File .......................................2-8 Configuring the VI to Save Data to a File.........................................................................................................................................1-16 Block Diagram...................................................2-7 Warning the User.............................................................................................................................................................................................................................................2-3 Modifying the Front Panel..........1-5 Wiring Objects on the Block Diagram .............................................................................................1-16 Front Panel.......................1-11 Customizing the Knob.........................................................................................................................................................................................

............................ 3-9 Customizing the Block Diagram Code ................ 4-6 Acquiring and Parsing Information for an Instrument..................Contents Controls and Indicators ........................................................................................................................................ 4-8 Instrument I/O Assistant Express VI ........................................................................... 3-10 Chapter 4 Acquiring Data and Communicating with Instruments Acquiring a Signal............................................. 3-2 Modifying the Signal ................. 2-13 Saving Data ......... 4-4 Graphing Data from a DAQ Device .......................................... 4-4 Editing an NI-DAQmx Task ... 2-14 Errors and Broken Wires................................................................................................................................................................................................................................................ 3-4 Configuring the VI to Run Continuously Until the User Stops It....................................................................... 2-14 Chapter 3 Expanding the Features of a VI Building a VI from a Blank Template......................................... 4-8 Tasks ....... 4-9 Getting Started with LabVIEW vi ni.............................................................................................................................................................................................................. 3-10 Displaying Data in a Table ............ 3-1 Opening a Blank VI ......................................................................................................................................................................................................... 3-6 Using a Table to Display Data ..................................................................................................................com ............................................. 4-7 Summary....................................................................... 3-3 Customizing the Front Panel..................................................................... 3-2 Adding an Express VI that Simulates a Signal ............................................................................... 3-5 Controlling the Speed of Execution ........................................................ 3-7 Summary. 3-9 Using the LabVIEW Help Resources .................................................................................................................................................... 4-1 Creating an NI-DAQmx Task ........................................................................................... 4-5 Visually Comparing Two Voltage Readings ................................................ 4-8 DAQ Assistant Express VI ............................................ 3-9 Controlling When a VI Stops Running....................................... 4-6 Communicating with an Instrument ............................................................ 4-6 Selecting an Instrument.......................................................... 3-9 Creating Controls and Indicators ................................................................................................................... 4-2 Testing the Task .................

....................5-2 VIs ...............................................................................5-6 Appendix A Technical Support and Professional Services Glossary Index © National Instruments Corporation vii Getting Started with LabVIEW .........................5-5 When to Use Other LabVIEW Features .....................................................................................................................................................Contents Chapter 5 Using Other LabVIEW Features NI Example Finder.........................................................................................................................................................5-3 Functions .....................................................................................................................................5-4 Converting from Dynamic Data..............................................................5-1 All Controls and Indicators.....................................................................5-1 All VIs and Functions ...........................................5-3 Data Types ................5-4 Dynamic Data Type..........................................................................5-4 Converting to Dynamic Data .........................................................................................

This icon denotes a note. menu names. Application Notes. This manual contains exercises to teach you how to develop basic applications in LabVIEW. controls and buttons on the front panel. sections of dialog boxes. Bold text also denotes parameter names. and palette names. such as menu items and dialog box options. which alerts you to important information. Use these summaries to review what you learned. LabVIEW includes the LabVIEW User Manual.adobe. In addition to this manual. If you select the Complete install option.0. which you can access by selecting Help»Search the LabVIEW Bookshelf in LabVIEW. you will see illustrations that provide information about the concepts associated with that step. These exercises take a short amount of time to complete and help you get started with LabVIEW.com to download Acrobat Reader. Throughout each exercise. LabVIEW Help. and select Options from the last dialog box. © National Instruments Corporation ix Getting Started with LabVIEW . Refer to the Adobe Systems Incorporated Web site at www. You must have Adobe Acrobat Reader with Search and Accessibility 5. other reference manuals. dialog boxes.5 or later installed to view the PDFs. The end of each chapter includes a summary of the main concepts taught in that chapter. The sequence File»Page Setup»Options directs you to pull down the File menu. and examples. Note Conventions The following conventions appear in this manual: » The » symbol leads you through nested menu items and dialog box options to a final action.About This Manual Use this manual to familiarize yourself with the LabVIEW graphical programming environment and the basic LabVIEW features you use to build data acquisition and instrument control applications. select the Page Setup item. bold Bold text denotes items that you must select or click in the software. This icon denotes a tip. which alerts you to advisory information. LabVIEW installs PDF versions of all LabVIEW manuals.

a cross reference. programming examples. sections of code. This font also emphasizes lines of code that are different from the other examples. emphasis. monospace monospace bold Getting Started with LabVIEW x ni. variables. subroutines. Bold text in this font denotes the messages and responses that the computer automatically prints to the screen. filenames and extensions. This font also denotes text that is a placeholder for a word or value that you must supply. This font is also used for the proper names of disk drives. functions. paths. Text in this font denotes text or characters that you should enter from the keyboard. and syntax examples. and code excerpts.About This Manual italic Italic text denotes variables. device names. directories. or an introduction to a key concept. operations. subprograms.com . programs.

In LabVIEW.Getting Started with LabVIEW Virtual Instruments 1 LabVIEW programs are called virtual instruments. you build a user interface. Building a Virtual Instrument In the following exercises. You can complete the exercises in approximately 40 minutes. and other input devices. and RS-485 instruments. dials. and motion control devices and GPIB. After you build the user interface. Use LabVIEW to communicate with hardware such as data acquisition. the front panel of the VI will look similar to the front panel in Figure 1-1. as well as tools to help you troubleshoot your code. analyzing. LabVIEW contains a comprehensive set of tools for acquiring. and storing data. with controls and indicators. displaying. RS-232. vision. and other displays. PXI. push buttons. © National Instruments Corporation 1-1 Getting Started with LabVIEW . you will build a VI that generates a signal and displays that signal in a graph. VXI. When you complete the exercises. or VIs. such as oscilloscopes and multimeters. LEDs. Indicators are graphs. Controls are knobs. you add code using VIs and structures to control the front panel objects. because their appearance and operation imitate physical instruments. The block diagram contains this code. or front panel.

Figure 1-2. In the LabVIEW dialog box. 1.Chapter 1 Getting Started with LabVIEW Virtual Instruments Figure 1-1. 2. click the New button to display the New dialog box. shown in Figure 1-2. Complete the following steps to create a VI that generates a signal and displays it on the front panel. Front Panel for the Acquiring a Signal VI Opening a New VI from a Template LabVIEW provides templates containing information from which you can build your VI. Launch LabVIEW.com . These templates help you get started with LabVIEW. LabVIEW Dialog Box Getting Started with LabVIEW 1-2 ni.

Click the OK button to open the template. Select VI from Template»Tutorial (Getting Started)»Generate and Display in the Create new list. This template VI generates and displays a signal. You also can double-click the name of the template VI in the Create new list to open the template. Figure 1-3. Notice that previews of the template VI appear in the Front panel preview and the Block diagram preview sections. New Dialog Box 4. © National Instruments Corporation 1-3 Getting Started with LabVIEW .Chapter 1 Getting Started with LabVIEW Virtual Instruments 3. Figure 1-3 shows the New dialog box and the Generate and Display template VI.

1. Examine the front panel of the VI. Notice that a sine wave appears on the graph. you can display the front panel by selecting Window»Show Front Panel. The title bar of the front panel indicates that this window is the front panel for the Generate and Display VI. you can undo recent edits by selecting Edit»Undo or pressing the <Ctrl-Z> keys. If the Controls palette. on the front panel. Examine the block diagram of the VI. The title bar of the block diagram indicates that this window is the block diagram for the Generate and Display VI.com . The block diagram appears with a white background and includes VIs and structures that control the front panel objects. Many physical instruments have knobs you can turn to change an input value. you can display the block diagram by selecting Window»Show Block Diagram. shown at left. 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. Note If the front panel is not visible. Note If the block diagram is not visible. Tip Throughout these exercises. Getting Started with LabVIEW 1-4 ni. click the Run button. select Window»Show Controls Palette to display it. Complete the following steps to add a knob control to the front panel. 8. Stop the VI by clicking the STOP button. is not visible on the front panel. appears with a gray background and includes controls and indicators. shown at left. 6. shown in Figure 1-4. 7. The user interface. or front panel.Chapter 1 Getting Started with LabVIEW Virtual Instruments 5. In the front panel toolbar.

3. The Simulate Signal Express VI simulates a signal based on the configuration that you specify. Notice the Simulate Signal Express VI. © National Instruments Corporation 1-5 Getting Started with LabVIEW . Select the knob control on the Numeric Controls palette and place it on the front panel to the left of the waveform graph. Changing the Signal Type The block diagram has a blue icon labeled Simulate Signal. You will use this knob in a later exercise to control the amplitude of a signal. 2. This icon represents the Simulate Signal Express VI. An Express VI is a component of the block diagram that you can configure to perform common measurement tasks. 5. Complete the following steps to change this signal to a sawtooth wave. Notice that when you move the cursor over icons on the Controls palette. or indicator appears. shown at left. Controls Palette 2. 1. The Simulate Signal Express VI simulates a sine wave by default. the full name of the subpalette. Click the Numeric Controls icon to access the Numeric Controls palette. the name of that subpalette appears in the gray space above all the icons on the palette. 4. Display the block diagram by selecting Window»Show Block Diagram or by clicking the block diagram. control. When you idle the cursor over any icon on any palette.Chapter 1 Getting Started with LabVIEW Virtual Instruments Figure 1-4. Move the cursor over the icons on the Controls palette to locate the Numeric Controls palette.vi to an easily accessible location. Right-click the Simulate Signal Express VI and select Properties from the shortcut menu to display the Configure Simulate Signal dialog box. Select File»Save As and save this VI as Acquiring a Signal.

notice how Amplitude is an option in the Configure Simulate Signal dialog box. Figure 1-5. Click the OK button to apply the current configuration and close the Configure Simulate Signal dialog box. 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. you can configure the amplitude of the sawtooth wave on the block diagram. appear on the block diagram and in the configuration dialog box. Configure Simulate Signal Dialog Box 4. you can configure the inputs in either location. 5. Move the cursor over the down arrows at the bottom of the Simulate Signal Express VI. Getting Started with LabVIEW 1-6 ni. Notice how you expanded the Simulate Signal Express VI to display a new input. When inputs. When a double-headed arrow appears. The Configure Simulate Signal dialog box should appear similar to Figure 1-5. shown at left. In Figure 1-5. click and drag the border of the Express VI until the Amplitude input appears. such as Amplitude. Because the Amplitude input appears on the block diagram. 6.Chapter 1 Getting Started with LabVIEW Virtual Instruments 3.com .

When the Wiring tool appears.Chapter 1 Getting Started with LabVIEW Virtual Instruments Wiring Objects on the Block Diagram To use the knob control to change the amplitude of the signal. until the Positioning tool appears. then drag the terminal to the left of the Simulate Signal Express VI. Move the cursor over the Knob terminal. Terminals are entry and exit ports that exchange information between the front panel and block diagram. shown at left. Data flows along this wire from the terminal to the Express VI. Notice how the cursor becomes an arrow. 1. Use the Wiring tool to wire objects together on the block diagram. to wire the two objects together. Notice how the cursor becomes a wire spool. Note The cursor does not switch to another tool while an object is selected. © National Instruments Corporation 1-7 Getting Started with LabVIEW . shown at left. Complete the following steps to wire the knob to the Amplitude input on the Simulate Signal Express VI. 3. shown at left. Use the Positioning tool to select. Make sure the Knob terminal is inside the loop. and resize objects. Notice that a wire appears and connects the two objects. 6. Select File»Save to save this VI. you must connect the two objects on the block diagram. Move the cursor over the arrow of the Knob terminal. shown at left. shown at left. 4. Click the Knob terminal to select it. 5. shown at left. Deselect the Knob terminal by clicking a blank space on the block diagram. or the Positioning tool. click the arrow and then click the Amplitude input of the Simulate Signal Express VI. The terminals are representations of front panel controls and indicators. position. or the Wiring tool. 2.

5. Getting Started with LabVIEW 1-8 ni. shown at left. Using the Operating tool. 1. Notice how the amplitude of the sawtooth wave changes as you turn the knob. Use the Operating tool to change the value of a control or select the text within a control. Display the front panel by selecting Window»Show Front Panel or by clicking the front panel. You cannot edit the front panel or block diagram while the VI runs. Notice how the cursor becomes a hand. Complete the following steps to run the Acquiring a Signal VI. Also notice that the y-axis on the graph autoscales to account for the change in amplitude. the Run button changes to a darkened arrow. shown at left.com . Click the Run button. the Abort Execution button does not always properly close the VI. Click the STOP button.Chapter 1 Getting Started with LabVIEW Virtual Instruments Running the VI Running a VI executes your solution. 4. Use the Abort Execution button only when errors prevent you from terminating the application using the STOP button. Note Although the Abort Execution button looks like a stop button. Move the cursor over the knob control. turn the knob to adjust the amplitude of the sawtooth wave. To indicate that the VI is running. 2. shown at left. National Instruments recommends stopping your VIs using the STOP button on 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. to stop the VI. 3. or the Operating tool.

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. © National Instruments Corporation 1-9 Getting Started with LabVIEW . If the Functions palette. 1. Press the <Delete> key to delete this wire. shown at left. is not visible. 2. Notice that the Configure Scaling and Mapping dialog box automatically opens when you place the Express VI on the block diagram. shown at left. 3. Figure 1-6. shown in Figure 1-6.Chapter 1 Getting Started with LabVIEW Virtual Instruments Modifying the Signal Complete the following steps to add scaling to the signal and display the results in the graph on the front panel. select Window»Show Functions Palette to display it. Select the Scaling and Mapping Express VI. use the Positioning tool to double-click the wire that connects the Simulate Signal Express VI to the Waveform Graph terminal. Functions Palette 4. On the block diagram. If there is no room between the Express VI and the terminal. move the Waveform Graph terminal to the right.

Configure Scaling and Mapping Dialog Box 6. 8. Click the OK button to apply the current configuration and close the Configure Scaling and Mapping dialog box. The Configure Scaling and Mapping dialog box should appear similar to Figure 1-7. Move the cursor over the arrow on the Sawtooth output of the Simulate Signal Express VI. to wire the two objects together. Define the value of the scaling factor by entering 10 in the Slope (m) text box. 7.Chapter 1 Getting Started with LabVIEW Virtual Instruments 5. shown at left. When the Wiring tool appears. Figure 1-7. click the arrow and then click the arrow on the Signals input of the Scaling and Mapping Express VI. Getting Started with LabVIEW 1-10 ni.com .

Select File»Save to save this VI. wire the Scaled Signals output of the Scaling and Mapping Express VI to the Waveform Graph terminal. 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. Using the Wiring tool. Complete the following steps to display two signals on the same graph. Notice the wires connecting the Express VIs and terminals. Move the cursor over the arrow on the Sawtooth output of the Simulate Signal Express VI. 1. Block Diagram for the Acquiring a Signal VI 10. The block diagram should appear similar to Figure 1-8. The arrows on the Express VIs and terminals indicate the direction that the data flows along these wires. © National Instruments Corporation 1-11 Getting Started with LabVIEW . use the Merge Signals function.Chapter 1 Getting Started with LabVIEW Virtual Instruments 9. Figure 1-8.

Using the Wiring tool. appears where the two wires connect. wire the Sawtooth output to the Waveform Graph terminal. Return to the front panel. shown at left. 1. Getting Started with LabVIEW 1-12 ni. This scaling occurs because you set the slope to 10 in the Scaling and Mapping Express VI.com . Customizing the Knob The knob control changes the amplitude of the sawtooth wave so labeling it Amplitude accurately describes the function of the knob. Select File»Save to save this VI. and turn the knob control. Figure 1-9. 4. Right-click the knob and select Properties from the shortcut menu to display the Knob Properties dialog box. Block Diagram Showing the Merge Signals Function 3. The block diagram should appear similar to Figure 1-9. Notice that the graph plots the sawtooth wave and the scaled signal. The Merge Signals function. and enter Amplitude in the text box. This function takes the two separate signals and combines them so that both can be displayed on the same graph. 5. run the VI. Also notice that the maximum value on the y-axis automatically changes to be 10 times the knob value. In the Label section on the Appearance tab. Complete the following steps to customize the appearance of a control on the front panel. delete the label Knob. You also can press the <Ctrl-S> keys to save a VI.Chapter 1 Getting Started with LabVIEW Virtual Instruments 2. Click the STOP button. 2.

Knob Properties Dialog Box 3. 4. © National Instruments Corporation 1-13 Getting Started with LabVIEW . try changing the colors for the Marker Text Color by clicking the color box located on the Scale tab. place a checkmark in the Ramp Visible checkbox. Experiment with other properties of the knob by using the Knob Properties dialog box. 7.Chapter 1 Getting Started with LabVIEW Virtual Instruments The Knob Properties dialog box should appear similar to Figure 1-10. As you build your VIs. click the OK button. 6. For example. Click the Scale tab and in the Scale Style section. 5. If you want to keep the changes you made. Figure 1-10. Save this VI. Tip Click the OK button to apply the current configuration and close the Knob Properties dialog box. you can experiment with different properties and configurations. You also can add and delete objects. Notice how the knob on the front panel instantly updates to reflect these changes. Click the Cancel button to avoid applying the changes you made while experimenting. Remember you can undo recent edits by selecting Edit»Undo or pressing the <Ctrl-Z> keys.

Chapter 1 Getting Started with LabVIEW Virtual Instruments Customizing the Waveform Graph The waveform graph indicator displays the two signals. Click the Line Color color box to display the color picker. select Sawtooth from the pull-down menu. shown in Figure 1-11. Select a new line color. the plot legend displays only one plot. 2. Right-click the waveform graph and select Properties from the shortcut menu to display the Graph Properties dialog box. To indicate which plot is the scaled signal and which is the simulated signal. 6. delete the current label and change the name of this plot to Scaled Sawtooth. Expanding a Plot Legend 3. Move the cursor over the top of the plot legend on the waveform graph. Place a checkmark in the Don’t use waveform names for plot names checkbox. Getting Started with LabVIEW 1-14 ni. Complete the following steps to customize the appearance of an indicator on the front panel. 1.com . Figure 1-11. you customize the plots. 4. Notice that while there are two plots on the graph. click and drag the border of the plot legend until the second plot name appears. 7. In the Name text box. When a double-headed arrow appears. Select Sawtooth (Scaled) from the pull-down menu. 5. On the Plots tab.

try disabling the autoscale feature located on the Scales tab. Click the OK button to apply the current configuration and close the Graph Properties dialog box. 10. click the OK button.Chapter 1 Getting Started with LabVIEW Virtual Instruments 8. Click the Cancel button to avoid applying the changes you made while experimenting. For example. If you want to keep the changes you made. Notice how the plot color on the front panel changes. © National Instruments Corporation 1-15 Getting Started with LabVIEW . Experiment with other properties of the graph by using the Graph Properties dialog box. Save and close this VI. 9. 11.

Indicators are graphs. You build the front panel by using controls and indicators. You can use one of the following methods to access the New dialog box. Front Panel The front panel is the user interface of a VI. including the ones used in this manual. Controls are knobs. Indicators simulate the output devices on a physical instrument and display data the block diagram acquires or generates. which are the interactive input and output terminals of the VI. The VI templates include the Express VIs. and front panel objects you need to get started building common measurement applications. You cannot access property dialog boxes for a control or indicator when the VI is running. Controls and indicators are located on the Controls palette. New Dialog Box and VI Templates The New dialog box contains many LabVIEW VI templates. dials. and other displays. functions. and other input devices. • • • Click the New button on the LabVIEW dialog box. Property Dialog Boxes Use property dialog boxes or shortcut menus to configure how controls and indicators appear or behave on the front panel.com .Chapter 1 Getting Started with LabVIEW Virtual Instruments Summary The following topics are a summary of the main concepts you learned in this chapter. push buttons. LEDs. The VI templates help you start building VIs for common measurements and other tasks. Getting Started with LabVIEW 1-16 ni. respectively. Right-click a control or indicator on the front panel and select Properties from the shortcut menu to access the property dialog box for that object. Controls simulate the input devices on a physical instrument and supply data to the block diagram of the VI. Click the arrow on the New button in the LabVIEW dialog box and select New from the New pull-down menu. Select File»New from the front panel or block diagram menu bar.

from Express VIs to Express VIs. Data flows from controls to Express VIs. Wires connect control and indicator terminals to Express VIs. You can resize an Express VI to display its inputs and outputs.Chapter 1 Getting Started with LabVIEW Virtual Instruments Block Diagram The block diagram contains the graphical source code for how the VI runs. © National Instruments Corporation 1-17 Getting Started with LabVIEW . and from Express VIs to indicators through the wires. Front panel objects appear as icon terminals on the block diagram. and outputs return data. the dialog box you use to configure that Express VI appears by default. The inputs and outputs for the Express VI depend on how you configure the VI. Set the options in this configuration dialog box to specify how an Express VI behaves. When you place an Express VI on the block diagram. Express VIs appear on the block diagram as expandable nodes with icons surrounded by a blue field. Express VIs Use Express VIs located on the Functions palette for common measurement tasks. Inputs accept data.

Front Panel for the Warning Light VI © National Instruments Corporation 2-1 Getting Started with LabVIEW . the front panel of the VI will look similar to the front panel in Figure 2-1. This chapter teaches you how to use LabVIEW to perform a basic analysis of a signal and how to save the analyzed data to a file. extracts the DC value of the signal. Building a VI from a Template In the following exercises. Figure 2-1. you will build a VI that generates a signal. and records the data.Analyzing and Saving a Signal 2 LabVIEW includes a set of Express VIs to help you analyze signals. When you complete the exercises. indicates if the signal exceeds a certain limit. You can complete the exercises in approximately 40 minutes.

Select the VI from Template»Tutorial (Getting Started)»Generate. 1. You also can double-click the name of the template VI in the Create new list to open the template. Notice when you move the cursor over the Express VI. Complete the following steps to select a new template VI that generates.Chapter 2 Analyzing and Saving a Signal Opening a New VI from a Template To build this VI. Display the block diagram by pressing the <Ctrl-E> keys. analyzes. Note You also can access the New dialog box by clicking the arrow on the New button and selecting New from the New pull-down menu or by selecting File»New from the front panel or block diagram menu bar. If the Context Help window. 5. Analyze. Figure 2-2. Getting Started with LabVIEW 2-2 ni. 4. the Context Help window displays information about the Express VI. 3. Move the cursor over the Amplitude and Level Measurements Express VI. The template VI simulates a signal and analyzes it for its root mean square (RMS) value. Click the OK button to open the template. is not visible. Note You also can press the <Ctrl-H> keys to display the Context Help window. you can start from the New dialog box. and displays a signal. select Help»Show Context Help from the block diagram menu bar to display the Context Help window. and Display template in the Create new list. Context Help Window 6. shown at left. including information about how it is configured. click the New button to display the New dialog box. In the LabVIEW dialog box.com . shown in Figure 2-2. 2.

3. 1. Modifying the Block Diagram The Simulate Signal Express VI simulates a sine wave by default. Type 0. 4. Complete the following steps to change the simulated signal from a sine wave to a DC signal with uniform white noise.Chapter 2 Analyzing and Saving a Signal Keep the Context Help window open and notice how it provides useful information as you complete the rest of this exercise. 2. You can customize the simulated signal by changing the options in the Configure Simulate Signal dialog box. Figure 2-3. Place a checkmark in the Add noise checkbox to add noise to the DC signal. Right-click the Simulate Signal Express VI and select Properties from the shortcut menu to display the Configure Simulate Signal dialog box. Select DC from the Signal type pull-down menu. Configure Simulate Signal Dialog Box © National Instruments Corporation 2-3 Getting Started with LabVIEW .1 in the Noise amplitude text box. The Configure Simulate Signal dialog box should appear similar to Figure 2-3. Notice that the Result Preview section displays a random signal.

com . Move the cursor over the RMS indicator until the Positioning tool appears. 1. 9. The block diagram now has a dashed wire with a red X. to select it and press the <Delete> key. 6. Display the block diagram. Getting Started with LabVIEW 2-4 ni. Tip Press the <Delete> key to delete the broken wire. This is a broken wire. The Error list window lists all errors in the VI and provides details about each error. shown at left. you can delete it. Press the <Ctrl-B> keys to delete all broken wires on the block diagram.vi to an easily accessible location. Complete the following steps to remove the RMS indicator from the front panel. Click the RMS indicator. Notice that the signal appears in the graph and the RMS value for the signal appears in the digital indicator. Also notice the Run button. 5. 6. shown at left. Notice how LabVIEW automatically displays the problem causing the error. Click the OK button to save the current configuration and close the Configure Simulate Signal dialog box. 8. Click the broken Run button to display the Error list window. 3. 7.Chapter 2 Analyzing and Saving a Signal 5. Select File»Save As and save this VI as Analysis. 4. In the Errors and Warnings listbox. Modifying the Front Panel If you decide that you do not want to use an indicator that comes with the template. 2. Click the STOP button. Display the front panel by pressing the <Ctrl-E> keys. double-click the Wire: has loose ends error to highlight the broken wire. Run the VI. appears broken to indicate the VI cannot run. shown at left.

Click the Help button. Tip You also can double-click the Express VI to open the Configure Amplitude and Level Measurements dialog box. shown at left. 5.Chapter 2 Analyzing and Saving a Signal 7. the inputs and outputs for the Express VI. Complete the following steps to reconfigure the Express VI to measure the peak to peak amplitude values of the signal. 8. Note You also can press the <Ctrl-L> keys to display the Error list window. 2. Notice that the Run button is no longer broken. Click the Close button to close this window. Select Windows»Show Error List to display the Error list window. Minimize LabVIEW Help to return to the Configure Amplitude and Level Measurements dialog box. 3. 1. and the configuration options. Right-click the Amplitude and Level Measurements Express VI and select Properties from the shortcut menu to display the Configure Amplitude and Level Measurements dialog box. © National Instruments Corporation 2-5 Getting Started with LabVIEW . The help topic describes the Express VI. In the Amplitude and Level Measurements topic. Analyzing the Amplitude of a Signal The Amplitude and Level Measurements Express VI includes options that you can use to analyze the voltage characteristics of a signal. Each Express VI has a corresponding help topic accessible by pressing the Help button. Remove the checkmark in the RMS checkbox in the Amplitude Measurements section. Now there are no errors listed in the Errors and Warnings listbox. find the output parameter whose description indicates that it takes a measurement from the maximum peak to the minimum peak of the signal. 4. in the bottom right corner of the Configure Amplitude and Level Measurements dialog box to display the LabVIEW Help topic for this Express VI.

You will use this LED in a later exercise to signal when a value has exceeded its limit. Change the label of the LED to Warning. Click the OK button to save the current configuration and close the Button Properties dialog box. Click the OK button to close the Configure Amplitude and Level Measurements dialog box and return to the block diagram. 7. shown at left.Chapter 2 Analyzing and Saving a Signal 6. Right-click the LED and select Properties from the shortcut menu to display the Button Properties dialog box.vi to an easily accessible location. Complete the following steps to add a warning light to the VI. 1. appears in the Results section with the corresponding value of the measurement. select the round LED indicator on the LEDs palette. 4. Select File»Save As and save this VI as Warning Light.com . 5. Notice that the RMS output in the Amplitude and Level Measurements Express VI changed to reflect the new Peak to Peak parameter. and place it on the front panel to the left of the waveform graph. Figure 2-4. From the Controls palette. use a warning light. shown in Figure 2-4. Peak to Peak. 3. Select the input or output you decided to use. LEDs Palette 2. Adding a Warning Light If you want a visual cue indicating when a value exceeds a specified limit. Notice how the option you selected. Getting Started with LabVIEW 2-6 ni.

6.Chapter 2 Analyzing and Saving a Signal Setting the Warning Level Limit To specify the value at which you want the warning light to turn on. For example. On the block diagram. If the Peak to Peak terminal appears to be on top of the wires of the Express VIs. 7. Greater Than indicates that the Express VI does a greater than comparison. 2. shown at left. Notice how a Peak to Peak terminal. select the Comparison Express VI on the Arithmetic & Comparison»Express Comparison palette and place it to the right of the Amplitude and Level Measurements Express VI. When the Positioning tool appears. appears on the block diagram. 5. shown at left. In the Configure Comparison dialog box.195 in the Constant value text box. select the > Greater than option from the Compare Condition section. right-click the wire connecting the Peak to Peak output to the Operand 1 input and select Create» Numeric Indicator from the shortcut menu. © National Instruments Corporation 2-7 Getting Started with LabVIEW . select Use constant value and type 0. In the Comparison Inputs section. Notice how the name of the Comparison Express VI reflects the operation of the Express VI. Complete the following steps to compare the peak to peak value to a limit you set. Move the cursor over the wire connecting the Peak to Peak output to the Operand 1 input. move the Peak to Peak terminal into the blank space above the Express VIs. Wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Operand 1 input of the Comparison Express VI. 1. move the Express VIs and Peak to Peak terminal around to create more space. use the Comparison Express VI. 3. 4. Close the configuration page and return to the block diagram.

Run the VI. Display the front panel. move the Warning terminal to the right of the Comparison Express VI. 4.195. This indicator displays the peak to peak value of the signal. 6. Click the STOP button to stop the VI. Wire the Result output of the Comparison Express VI to the Warning terminal. Block Diagram for the Warning Light VI 3. Make sure the Warning terminal is inside the loop. 5. Complete the following steps to provide a visual cue to the user when the peak to peak value of the signal exceeds a specified limit. the Warning indicator lights up. The block diagram should appear similar to Figure 2-5.Chapter 2 Analyzing and Saving a Signal Warning the User After specifying the values at which you want the warning light to turn on. 2. Figure 2-5. On the block diagram. as shown in Figure 2-5.com . Notice that when the peak to peak value exceeds 0. Notice how a numeric indicator also appears on the front panel labeled Peak to Peak. you must wire the warning light to the Comparison Express VI. Getting Started with LabVIEW 2-8 ni. 1. Select File»Save to save this VI.

In the Configure Write LabVIEW Measurement File dialog box.lvm and displays the full path to the test. select the Append to file option in the If a file already exists section. use the Write LabVIEW Measurement File Express VI. LabVIEW saves the data to the test.lvm file is a LabVIEW measurement data file. Click the STOP button on the front panel. 4.Chapter 2 Analyzing and Saving a Signal Configuring the VI to Save Data to a File To store information about the data your VI generates. Display the front panel and run the VI.lvm file without erasing the existing data in the file if a file by that name exists already. LabVIEW installs the LabVIEW Data directory in the default file directory of the operating system. Wire the Peak to Peak output of the Amplitude and Level Measurements Express VI to the Signals input of the Write LabVIEW Measurement File Express VI. 2. By selecting Append to file. Notice that the File name text box indicates that the output file is test. 3. © National Instruments Corporation 2-9 Getting Started with LabVIEW .lvm file. When you want to view the data. A . 2. LabVIEW writes all the data to the test. which LabVIEW places in the default LabVIEW Data directory. 4. Select the Write LabVIEW Measurement File Express VI on the Output palette and place it on the block diagram below and to the right of the Amplitude and Level Measurements Express VI. 3. 1. 1. use the file path displayed in the File name text box to access the test. Complete the following steps to generate the test. Complete the following steps to build a VI that saves peak to peak values and other information to a LabVIEW data file.lvm file. 5.vi to an easily accessible location. Select the One header only option in the Segment Headers section. Saving Data to a File When you run this VI. Close the Configure Write LabVIEW Measurement File dialog box and return to the block diagram.lvm file. Enter the following text in the File Description text box: Sample of peak to peak values.lvm file. Select File»Save As and save this VI as Save Data.

4. Close the Button Properties dialog box.Chapter 2 Analyzing and Saving a Signal 5. select Latched When Pressed from the Button Behavior list. Select Insert Input/Output from the shortcut menu to insert the Comment input. 3. 1. Using the Button Properties dialog box. select the rocker button on the Buttons & Switches palette and place it to the right of the waveform graph.lvm file with a spreadsheet or word processing application. 6. Use the Operation tab to specify how a button behaves when a user clicks it. 4. On the front panel. open the LabVIEW Data\test.lvm in the File name text box to save the data to a different file. Right-click the Signal input of the Write LabVIEW Measurement File Express VI. 1. To view the data you saved. click the button in the Preview Selected Behavior section. 3. Close the file when you finish looking at it and return to the Save Data VI. Change the file name test. On the Operation tab. you can configure the Write LabVIEW Measurement File Express VI to save peak to peak values only when a user presses a button. 2. Saving Data when Prompted by a User Complete the following steps to build a VI that logs data to a file when the user clicks a button on the front panel. change the label of the button to Write to File. 5. Adding a Button that Stores Data when Pressed If you want to store only certain data. 2. double-click the Write LabVIEW Measurement File Express VI to access the Configure Write LabVIEW Measurement File dialog box. Complete the following steps to add a button to the VI and configure how the button responds when a user clicks it. Save this VI.lvm to Selected Samples. Getting Started with LabVIEW 2-10 ni. On the block diagram. To see how the button reacts to a click.com . Close the Configure Write LabVIEW Measurement File dialog box.

The block diagram should appear similar to Figure 2-6. 6. Wire the Write to File terminal to the Enable input of the Write LabVIEW Measurement File Express VI. To select a specific input. Display the front panel and run the VI. Block Diagram for the Save Data VI 8. Notice that this method is a different way of displaying and selecting the inputs and outputs of an Express VI. Click the Write to File button several times. In the previous exercise you learned to add inputs and outputs by expanding the Express VI using the down arrows. Right-click the Comment input of the Write LabVIEW Measurement File Express VI. 9. © National Instruments Corporation 2-11 Getting Started with LabVIEW . Move the Write to File terminal to the left of the Write LabVIEW Measurement File Express VI. then change the input to the specific one you want to use. Figure 2-6. you may need to add an input first. 7. The inputs and outputs of an Express VI appear in a predetermined order when you add new inputs and outputs. Click the STOP button on the front panel. Select Select Input/Output»Enable from the shortcut menu to insert the Enable input.Chapter 2 Analyzing and Saving a Signal 5.

test.com . Getting Started with LabVIEW 2-12 ni.lvm file with a spreadsheet or word processing application. open the Selected Samples. To view the data you saved. Save and close this VI.Chapter 2 Analyzing and Saving a Signal 10. 11.lvm file.lvm only recorded the data when you pressed the Write to File button.lvm recorded all the data generated by the Save Data VI. Notice how the Selected Samples. whereas Selected Samples.lvm file differs from the test.

Function.com to download Acrobat Reader. controls. LabVIEW Help Resources LabVIEW includes extensive documentation for new and experienced LabVIEW users. To access the Context Help window. Controls and Indicators You can configure the controls and indicators on the front panel to perform tasks depending on what you want your VI to do. To access help information for Express VIs.0. The LabVIEW Help contains reference information about LabVIEW Express VIs. VIs. You can configure the buttons to operate in one of six ways using the Operations tab of the Button Properties dialog box. • You can build VIs that automatically perform a task whenever certain conditions are met.5 or later to access the PDFs. the Context Help window.Chapter 2 Analyzing and Saving a Signal Summary The following topics are a summary of the main concepts you learned in this chapter. Note All LabVIEW manuals and Application Notes also are available as PDFs. tools. You must have Adobe Acrobat Reader with Search and Accessibility 5. & How-To Help or pressing the <Ctrl-?> keys. You also can access the LabVIEW Help by selecting Help»VI. The Context Help window displays basic information about LabVIEW objects when you move the cursor over each object. indicators. and Application Notes. and functions. such as displaying a warning light when a value exceeds a certain limit. You also can press the <Ctrl-H> keys to display the Context Help window. LabVIEW Help. click the Help button. palettes. examples. Help resources include manuals. shown at left. • © National Instruments Corporation 2-13 Getting Started with LabVIEW . This help file also includes step-by-step instructions for using LabVIEW features. select Help»Show Context Help. Refer to the Adobe Systems Incorporated Web site at www.adobe. You can build VIs that let users control when an Express VI executes using buttons and the Enable input. in the configuration dialog box while configuring an Express VI. The following is a summary of the different ways you learned to use controls and indicators in this chapter. menus.

lvm file includes headers that contain information about the data. A broken wire appears as a dashed black line with a red X in the middle.Chapter 2 Analyzing and Saving a Signal Saving Data The Write LabVIEW Measurement File Express VI saves data that a VI generates and analyzes to a data file.com . Double-click the error in the Errors and Warnings listbox to highlight the problem causing the error. Click the Help button for more information about why the wire is broken. the . In addition to the data an Express VI generates. such as deleting wired objects. To store the data files LabVIEW generates.lvm file. Broken wires occur for a variety of reasons. the VI is broken and cannot run. The LabVIEW measurement data file (.lvm) is a tab-delimited text file you can open with a spreadsheet application or a text-editing application. LabVIEW installs the LabVIEW Data directory in the default file directory of the operating system to help you organize and locate the data files LabVIEW generates. Click the broken Run button or select Window»Show Error List to find out why a VI is broken. You can use the Error list window to locate errors on the block diagram. This information also appears in the Context Help window when you move the Wiring tool over a broken wire. Errors and Broken Wires The Run button appears broken when the VI you are creating or editing contains errors. If the Run button is still broken when you finish wiring the block diagram. Right-click the wire and select List Errors from the shortcut menu to display the Error list window. Note Refer to the LabVIEW Help for information about saving data to and retrieving data from a . Getting Started with LabVIEW 2-14 ni. such as the date and time the data was generated. The VI cannot run if the block diagram includes broken wires. Move the Wiring tool over a broken wire to display a tip strip that describes why the wire is broken.

reduces the number of samples in the signal. and displays the resulting data in a table on the front panel. You can complete the exercises in approximately 30 minutes. When you complete the exercises. Figure 3-1. Building a VI from a Blank Template In the following exercises. sometimes you need to build a VI for which a template is not available.Expanding the Features of a VI 3 You can choose one of many LabVIEW VI templates to use as a starting point. the front panel of the VI will look similar to the front panel in Figure 3-1. you will open a blank VI and add Express VIs and structures to the block diagram to build a new VI. You will build a VI that generates a signal. Front Panel for the Reduce Samples VI © National Instruments Corporation 3-1 Getting Started with LabVIEW . However. This chapter teaches you how to build and customize a VI without using a template.

shown at left. Click the thumbtack. In the LabVIEW dialog box.Chapter 3 Expanding the Features of a VI Opening a Blank VI If no template is available for the task you want to create.com . find the Express VI that can output a sine wave signal. Complete the following steps to open a blank VI. Note You also can open a blank VI by selecting Blank VI from the Create new list in the New dialog box or by selecting File»New VI from the front panel or block diagram menu bar. Select the Input palette on the Functions palette and move the cursor over the Express VIs on the Input palette. If the Functions palette is not visible. right-click any blank space on the block diagram to bring up the temporary version of the Functions palette. press the <Ctrl-H> keys to open the Context Help window. The Configure Simulate Signal dialog box appears. 3. Select the Express VI and place it on the block diagram. Adding an Express VI that Simulates a Signal Complete the following steps to find the Express VI you want to use and then add it to the block diagram. and Samples 2. If the Context Help window is not visible. 4. 1. Amplitude. 1. Idle the cursor over the various options in the Configure Simulate Signal dialog box. 2. to open the Context Help window. Note You can right-click on a blank space on the block diagram or the front panel to bring up the Functions or Controls palettes. you can start with a blank VI and add Express VIs to accomplish the specific task. in the upper left corner of the Functions palette to place the palette on the screen. You also can press the Show Context Help Window button. click the arrow on the New button and select Blank VI from the shortcut menu or press the <Ctrl-N> keys to open a blank VI. Notice that the Context Help window displays information about the function of each Express VI. Notice that a blank front panel and block diagram appear. shown at left. From the information provided in the Context Help window. Getting Started with LabVIEW 3-2 ni. 5. such as Frequency (Hz).

Configure the Sample Compression Express VI to reduce the signal by a factor of 25 using the mean of these values. 3. shown at left. Close the Configure Sample Compression dialog box. 2. click the Place on the block diagram button. Move the cursor to the block diagram. 5. Notice that the Context Help window now displays the configuration of the Simulate Signal Express VI. © National Instruments Corporation 3-3 Getting Started with LabVIEW . 6. to select the Express VI. Click the Search tab and type sample compression in the Type in the word(s) to search for text box.7 and amplitude of 2. Notice that this word choice reflects what you want this Express VI to do—compress. wire the Sine output in the Simulate Signal Express VI to the Signals input in the Sample Compression Express VI. the number of samples in a signal. & How-To Help to open the LabVIEW Help. Using the Wiring tool. 4. 6.vi to an easily accessible location. Function. or reduce. After you read the description of the Express VI. 1. 9. 7. 8. Configure the Simulate Signal Express VI to generate a sine wave with a frequency of 10. 10. Read the information that appears in the Context Help window. Save this VI as Reduce Samples. Select the Sample Compression Express VI topic to display the topic that describes the Sample Compression Express VI. Notice how LabVIEW attaches the Sample Compression Express VI to the cursor. 7. Modifying the Signal Complete the following steps to use the LabVIEW Help to search for the Express VI that reduces the number of samples in a signal. Place the Sample Compression Express VI on the block diagram to the right of the Simulate Signal Express VI. 8. Select Help»VI. Notice how the signal displayed in the Result Preview window changes to reflect the configured sine wave. 9. Move the cursor over the Simulate Signal Express VI and read the information that appears in the Context Help window.Chapter 3 Expanding the Features of a VI per second (Hz). Close the Configure Simulate Signal dialog box.

4. 1. Arrange the objects on the block diagram so that they appear similar to Figure 3-2. wire the Mean output in the Sample Compression Express VI to the Sine terminal. Using the Wiring tool. 3. Notice that the Merge Signals function appears.com .Chapter 3 Expanding the Features of a VI Customizing the Front Panel In the previous exercises. 5. Right-click the Enable input and select Create»Control to create the Enable switch. you added controls and indicators to the front panel using the Controls palette. Right-click the wire linking the Sine output in the Simulate Signal Express VI to the Signals input in the Signal Compression Express VI and select Create»Graph Indicator. Right-click the Mean output of the Sample Compression Express VI and select Insert Input/Output from the shortcut menu to insert the Enable input. 6. Right-click the Mean output in the Sample Compression Express VI and select Create»Numeric Indicator to create a numeric indicator. Notice that you can create controls and indicators from the block diagram. 2. Tip You can right-click any wire and select Clean Up Wire from the shortcut menu to have LabVIEW automatically arrange the wires for you. You also can add controls and indicators from the block diagram. Getting Started with LabVIEW 3-4 ni. LabVIEW automatically creates terminals that are labeled and formatted correctly. Complete the following steps to create controls and indicators. When you create controls and indicators using this method.

3. To run the VI until a condition is met. Display the front panel. then stops executing. the VI runs once. Place the top left corner of the While Loop here. Save this VI. 2. Notice that the controls and indicators you added automatically appear on the front panel with labels that correspond to their function. Display the front panel and run the VI. 1. Display the block diagram and select the While Loop on the Execution Control palette. Complete the following steps to add a While Loop. © National Instruments Corporation 3-5 Getting Started with LabVIEW . 8. Configuring the VI to Run Continuously Until the User Stops It In the current state. Also notice how there is no STOP button. Block Diagram for the Reduce Samples VI 7. Notice how the VI runs once and then stops. Move the cursor to the upper left corner of the block diagram. generates one signal. you can add a While Loop to the block diagram.Chapter 3 Expanding the Features of a VI Figure 3-2.

250 in the Time delay (seconds) text box. Notice that the VI now runs until you click the STOP button. 4. Save this VI.com . 5. as shown in Figure 3-3. This While Loop is configured to stop when the user clicks the STOP button. On the block diagram. Display the front panel and run the VI. Type . 5. Complete the following steps to control the speed at which the VI executes. Getting Started with LabVIEW 3-6 ni. select the Time Delay Express VI on the Execution Control palette and place it inside the loop. appears with a STOP button wired to the condition terminal. Figure 3-3. Display the front panel and run the VI. 2. This time delay specifies how fast the loop runs. With a . Click and drag the cursor diagonally to enclose all the Express VIs and wires. shown at left. Close the Configure Time Delay dialog box. Controlling the Speed of Execution To plot the points on the waveform graph more slowly. Placing the While Loop around the Express VIs Notice that the While Loop. you can add a time delay to the block diagram. 1.Chapter 3 Expanding the Features of a VI 4. A While Loop executes the functions inside the loop until the user presses the STOP button. 3.250 second time delay. the loop iterates once every quarter of a second.

shown at left. 5. 2. Notice that the Table terminal appears wired to the Build Table Express VI automatically. select the Express Table indicator on the Text Indicators palette and place it on the front panel to the right of the waveform graph. 3. Drag the cursor diagonally until the selection rectangle encloses the Build Table Express VI and the Table terminal. Notice that the While Loop automatically resizes to enclose the Build Table Express VI and the Table terminal. Click the STOP button to stop the VI. 4. click an open area on the block diagram to the left of the Build Table Express VI and the Table terminal. Click the Enable switch and notice the change on the graph. wire the Mean terminal of the Sample Compression Express VI to the Signals input of the Build Table Express VI. 7. Drag the objects into the While Loop to the right of the Mean terminal. If the Build Table Express VI and the Table terminal are not selected already. On the front panel. Display the block diagram. If the Enable switch is off. Using the Wiring tool. A moving dashed outline called a marquee highlights the Build Table Express VI. the Table terminal. the graph displays the reduced signal. the graph does not display the reduced signal.Chapter 3 Expanding the Features of a VI 6. Notice how if the Enable switch is on. Using a Table to Display Data Complete the following steps to display a collection of mean values in a table on the front panel. 1. © National Instruments Corporation 3-7 Getting Started with LabVIEW . and the wire joining the two.

For example. Figure 3-4. the table does not record the mean values. Click the Enable switch. Experiment with properties of the table by using the Table Properties dialog box. The table displays the mean values of every 25 samples of the sine wave.com . Notice if the Enable switch is off. 8. 9. Stop the VI. try changing the number of columns to one. Block Diagram of the Reduce Samples VI 6. Getting Started with LabVIEW 3-8 ni. 7. Display the front panel and run the VI. Save and close this VI.Chapter 3 Expanding the Features of a VI The block diagram should appear similar to Figure 3-4. 10.

or wire. and selecting an option from the Create shortcut menu. • The Context Help window displays basic information about LabVIEW objects when you move the cursor over each object. and structures that you can use to customize a VI.Chapter 3 Expanding the Features of a VI Summary The following topics are a summary of the main concepts you learned in this chapter. palettes. and Search tabs. Objects with context help information include VIs. structures. Creating Controls and Indicators Create controls and indicators that are wired to Express VIs from the block diagram by right-clicking the Express VI input. indicators. Express VIs. You can find and select an Express VI and other block diagram objects in the LabVIEW Help. Use the Contents tab to get an overview of the topics and structure of the help. you can create controls and indicators. use the Contents. • • • Customizing the Block Diagram Code There are many controls. When you place an Express VI on the block diagram. control when a VI stops running. Use the Search tab to search the help for a word or phrase. Both provide information that describe the functionality of the Express VI and how to configure the Express VI. Use the Index tab to find a topic by keyword. To navigate the LabVIEW Help. Using the LabVIEW Help Resources You can use the Context Help window and the LabVIEW Help to learn more about Express VIs. the Context Help window displays a brief description of the Express VI and information about how you configured the Express VI. © National Instruments Corporation 3-9 Getting Started with LabVIEW . and display generated data in a table. To customize a VI. The following is a summary of the different ways you learned to use the help resources in this chapter. and dialog box components. Click the Place on the block diagram button to select a block diagram object and place it on the block diagram. output. Index.

When you place or move an object in a While Loop near the border. Getting Started with LabVIEW 3-10 ni.com . Use the Build Table Express VI to build a table of collected data. as well as the speed at which the VI runs. The Execution Control palette includes objects that let you control the number of times a VI runs. Displaying Data in a Table The table indicator displays collected data. The While Loop stops running when a stop condition is met. the loop automatically resizes to add space for that object.Chapter 3 Expanding the Features of a VI Controlling When a VI Stops Running Use the While Loop to continually run the code enclosed within the loop.

The following exercises require that you have installed NI-DAQmx and an NI-DAQmx-supported device. If you do not have NI-DAQmx installed or an NI-DAQmx-supported device. Refer to the National Instruments Web site at ni.Acquiring Data and Communicating with Instruments 4 This chapter introduces you to the Express VIs you use for data acquisition and instrument communication on a PC running Windows. To launch this help tutorial. Acquiring a Signal In the following exercises. Refer to the Taking an NI-DAQmx Measurement in LabVIEW help tutorial for information about additional methods you can use to create NI-DAQmx tasks.com/daq for the list of NI-DAQmx-supported devices. Note Complete the following exercises to create an NI-DAQmx task that continuously takes a voltage reading and plots the data on a waveform graph. © National Instruments Corporation 4-1 Getting Started with LabVIEW . You can complete the exercises in approximately 30 minutes. select Help»Taking an NI-DAQmx Measurement in LabVIEW. Refer to the LabVIEW Measurements Manual for information about data acquisition and instrument communication on all platforms. refer to the LabVIEW Measurements Manual for information about using Traditional NI-DAQ for data acquisition. you will use the DAQ Assistant Express VI to create an NI-DAQmx task.

select the physical channel to which the signal is connected. The dialog box displays a list of channels on each DAQ device installed. The DAQ Assistant opens a new window. shown at left. 2. Select Voltage to create a new voltage analog input task. triggering. on the Input palette and place it on the block diagram. Select the DAQ Assistant Express VI. you can create a task to measure temperature from one or more channels on a DAQ device. Complete the following steps to create and configure a task that reads a voltage level from a DAQ device.Chapter 4 Acquiring Data and Communicating with Instruments Creating an NI-DAQmx Task In NI-DAQmx. a task is a collection of one or more channels.com . which displays options for configuring the channel you selected to complete a task. a task represents a measurement or generation you want to perform. 4. timing. and then click the Finish button. Conceptually. Getting Started with LabVIEW 4-2 ni. 5. 1. For example. 3. In the My Physical Channels listbox. and other properties that apply to the task itself. The number of channels listed depends on the number of channels you have on the DAQ device. Click the Analog Input button to display the Analog Input options. The DAQ Assistant launches and a Create New dialog box appears. Open a new VI. shown in Figure 4-1. such as ai0.

Configuring a Task Using the DAQ Assistant 6. Enter a value of 1000 in the Samples To Read input box. 8.Chapter 4 Acquiring Data and Communicating with Instruments Figure 4-1. In the Task Timing tab. 7. In the Input Range section of the Settings tab. © National Instruments Corporation 4-3 Getting Started with LabVIEW . select the Acquire N Samples option. enter 10 for the Max value and enter -10 for the Min value.

An Analog Input Test Panel dialog box appears. 6. 1. Complete the following steps to plot the data from the channel in a waveform graph and change the name of the signal. 10. Display the front panel. 3.com . Save this VI. Right-click Voltage in the Channel List listbox and select Rename to display the Rename a channel or channels dialog box. 4. Graphing Data from a DAQ Device Using the task you created in the previous exercise. you can graph the data acquired from a DAQ device. 5. Run the VI three or four times and observe the waveform graph. shown at left. Notice that First Voltage Reading appears in the waveform graph plot legend. and click the OK button. Save this VI as Read Voltage. 7. 4. 2. and then click the OK button to return to the DAQ Assistant. 2. enter First Voltage Reading. 9. Complete the following steps to confirm that you are acquiring data. Notice that Voltage appears in the waveform graph plot legend. 1. Click the OK button to apply this configuration and return to the block diagram. Click the OK button to return to the block diagram. In the New Name text box. Click the Start button once or twice to confirm that you are acquiring data. Right-click the DAQ Assistant Express VI and select Properties to rename the channel. Display the front panel and run the VI. 3. right-click the data output and select Create» Graph Indicator. Click the Test button.vi to an easily accessible location.Chapter 4 Acquiring Data and Communicating with Instruments Testing the Task You can test the task to verify that you correctly configured the channel. 8. On the block diagram. Display the block diagram. Getting Started with LabVIEW 4-4 ni. Tip You also can select the name of the channel and press the <F2> key to access the Rename a channel or channels dialog box.

1. 3.Chapter 4 Acquiring Data and Communicating with Instruments Editing an NI-DAQmx Task You can add a channel to the task so that you can compare two separate voltage readings. 8. Select any unused physical channel in the My Physical Channels listbox. these options apply to all the channels in the Channel List. Click the Add Step button. 5. 6. to open the Add Channels To Task dialog box. Display the block diagram and double-click the DAQ Assistant Express VI to add a new channel. Place a While Loop around the DAQ Assistant Express VI and the graph indicator wired to the data output. Complete the following steps to add a new channel to the task and acquire data continuously. Figure 4-2. select the Acquire Continuously option. Click the OK button to apply this configuration and return to the block diagram. Block Diagram for the Read Voltage VI © National Instruments Corporation 4-5 Getting Started with LabVIEW . When you set timing and triggering options in the DAQ Assistant. In the Task Timing tab. 4. 7. 2. You also can customize the task to acquire the voltage readings continuously. Rename the channel Second Voltage Reading. The block diagram should appear similar to Figure 4-2. Click the OK button to return to the DAQ Assistant. shown at left.

Click the Show Help button. Communicating with an Instrument Instrument drivers simplify instrument control and reduce test program development time by eliminating the need to learn the programming protocol for each instrument. The help window below Getting Started with LabVIEW 4-6 ni. 3. The instrument must be powered on to use the Instrument I/O Assistant Express VI. 4. Make sure you turn on the instrument you want to use. Complete the following steps to select an instrument using the Instrument I/O Assistant Express VI. Select the Instrument I/O Assistant Express VI on the Input palette and place it on the block diagram. select a color.com/idnet to find a driver for your instrument. On the front panel. 3. 2. shown at left. Complete the following steps to customize the plot color on the waveform graph. you must select the instrument with which you want to communicate. so that the plot is easy to read. Complete the following exercises to communicate with an instrument. Right-click First Voltage Reading and select Color from the shortcut menu. Save this VI. 1. Visit the NI Instrument Driver Network at ni. such as yellow. 1.com .Chapter 4 Acquiring Data and Communicating with Instruments Visually Comparing Two Voltage Readings Because you have two voltage readings displayed on a graph. Using the color picker. 2. you can customize the plots to distinguish between the two. expand the plot legend to include two plots. Use an instrument driver for instrument control when possible. you can use the Instrument I/O Assistant Express VI to communicate with your instrument. Run the VI. If a driver is not available for your instrument. The help window on top contains procedural information about using the Instrument I/O Assistant. National Instruments provides instrument drivers for a wide variety of instruments. Change the plot color of Second Voltage Reading. Notice how the Show Help button displays the help to the right of the dialog box. Selecting an Instrument Before communicating with an instrument. in the upper right corner of the Instrument I/O Assistant dialog box. Notice two plots now appear in the graph and the plot legend automatically updates to include both plot names.

A token is a parsed data selection. Follow the procedures in the help window on top to select the instrument with which you want to communicate. in the Instrument I/O Assistant dialog box for more information about parsing data. The response is an identification number string that describes the instrument. In this exercise. you will learn to use the Instrument I/O Assistant Express VI to acquire and parse identification information for an instrument. The Instrument I/O Assistant sends the command to the instrument. *IDN? is a query that most instruments recognize. Click the Run Sequence button. 6. 4. 1. shown at left. Click the OK button to return to the block diagram. 7. 5. Parse the instrument name as an ASCII string. 5. Click the Add Step button. you can send commands to the instrument to retrieve data. in the upper right corner of the Instrument I/O Assistant dialog box to minimize the help window. Click the Hide Help button. configure the properties of the instrument. Enter *IDN? in the Enter a command text box. Notice that the name that you entered in the Token name text box is the output of the Instrument I/O Assistant Express VI. If necessary. 2. © National Instruments Corporation 4-7 Getting Started with LabVIEW . If the instrument does not accept this command. and select Query and Parse. 4. Complete the following steps to communicate with your instrument. shown at left. shown at left.Chapter 4 Acquiring Data and Communicating with Instruments provides context-sensitive help about various controls and indicators in the dialog box. refer to the reference manual for the instrument for a list of commands the instrument does understand. You also can use Instrument I/O Assistant to parse ASCII numbers and binary data. 3. 6. and the instrument returns its identification information. Assign a name to the token in the Token name text box. Acquiring and Parsing Information for an Instrument After selecting the instrument. Click the Parsing help button.

DAQ Assistant Express VI You can use the DAQ Assistant Express VI to graphically configure channels or common measurement tasks. you can add or remove channels from that task. and other properties that apply to the task itself. select Help»Taking an NI-DAQmx Measurement in LabVIEW. Conceptually. you do not have to configure the channels individually to perform analog input operations but instead access the single task. you can interactively build a measurement channel or task.com/daq for information about devices supported in NI-DAQmx. timing.com . Creating a Typical Measurement Application. After you create a task. To launch this help tutorial. After you create a task. You can use the DAQ Assistant Express VI to control devices supported in NI-DAQmx. NI-DAQmx is a programming interface for communicating with data acquisition devices. Place the DAQ Assistant Express VI on the block diagram to configure channels and tasks for use with NI-DAQmx for data acquisition. refer to the LabVIEW Measurements Manual for information on using Traditional NI-DAQ for data acquisition. of the LabVIEW Measurements Manual for more information on channels and tasks. If your device is not supported in NI-DAQmx. Refer to the National Instruments Web site at ni. a task represents a measurement or generation you want to perform. Using the DAQ Assistant Express VI. Refer to the Taking an NI-DAQmx Measurement in LabVIEW help tutorial for information about the DAQ Assistant. For example. triggering. Getting Started with LabVIEW 4-8 ni. you can configure a collection of channels for analog input operations. Refer to the Channels Versus Tasks section of Chapter 5.Chapter 4 Acquiring Data and Communicating with Instruments Summary The following topics are a summary of the main concepts you learned in this chapter. a task is a collection of one or more channels. Tasks In NI-DAQmx.

and triggering the instrument. National Instruments offers thousands of instrument drivers online. Ethernet.com/idnet to find a driver for your instrument. you can use the Instrument I/O Assistant Express VI to communicate with your instrument. or GPIB instrument and graphically parse the response. writing to. Each routine corresponds to a programmatic operation such as configuring. Refer to the Instrument I/O Assistant Help for information about communicating with an external device. Visit the NI Instrument Driver Network at ni. © National Instruments Corporation 4-9 Getting Started with LabVIEW . Start the Instrument I/O Assistant by placing the Instrument I/O Assistant Express VI on the block diagram or by double-clicking the Instrument I/O Assistant Express VI icon on the block diagram. reading from. If a driver is not available for your instrument. You can use the Instrument I/O Assistant to communicate with a serial.Chapter 4 Acquiring Data and Communicating with Instruments Instrument I/O Assistant Express VI An instrument driver is a set of software routines that control a programmable instrument.

these template VIs are only a subset of the hundreds of example VIs included with LabVIEW. You can modify any example VI to fit an application. However. All Controls and Indicators The controls and indicators located on the subpalettes at the top level of the Controls palette are a subset of the complete set of built-in controls and indicators available in LabVIEW. Refer to the LabVIEW User Manual for more information about these concepts. The All Controls subpalette contains all the controls and indicators that you can use the create the front panel. To search all examples using LabVIEW VIs. the All Controls subpalette categorizes controls and indicators © National Instruments Corporation 5-1 Getting Started with LabVIEW . As you familiarize yourself with the LabVIEW environment. you also can access hundreds of example VIs on the NI Developer Zone at ni. NI Example Finder The New dialog box contains many LabVIEW template VIs that you can use to start building VIs. This chapter introduces you to some of the concepts you should be familiar with as you start using other LabVIEW features.com/zone.Using Other LabVIEW Features 5 The previous chapters in this manual introduce you to most of the LabVIEW features you need to build common measurement applications. The NI Example Finder is the gateway to all installed examples and the examples located on the NI Developer Zone. To launch the NI Example Finder. In addition to the example VIs that ship with LabVIEW. you might find that you need to enhance your VIs or that you need more fine-grain control of the processes your VIs perform. use the NI Example Finder. select Help»Find Examples from the front panel or block diagram menu bar. or you can copy and paste from an example into a VI that you create. You also can launch the NI Example Finder by clicking the arrow on the Open button on the LabVIEW dialog box and selecting Examples from the shortcut menu. However.

Note If you change the palette view as described in the All Controls and Indicators section of this chapter. functions. All VIs and Functions The Express VIs and structures located on the subpalettes at the top level of the Functions palette are a subset of the complete set of built-in VIs. On the All Controls subpalette. 3. For example. Complete the following steps to change the palette view and display the subpalettes from the All Controls subpalette at the top level of the Controls palette. Structures located on the All Functions subpalette are similar to the structures located on the Execution Control subpalette. the subpalettes from the All Functions subpalette appear at the top level of Getting Started with LabVIEW 5-2 ni. However. Building the Front Panel. and structures that you can use the create the block diagram.com . shown at left. Select Advanced from the Palette View pull-down menu. Click the Options button. on the Controls palette toolbar to display the Controls/Functions Palettes page of the Options dialog box. when you select a While Loop on the Execution Control subpalette and place it on the block diagram. a stop button also appears on the block diagram and is wired to the conditional terminal. Click the OK button to apply the changes. functions. For example. if you select a While Loop on the Structures subpalette and place it on the block diagram. because these controls and indicators are all numeric objects. Complete the following steps to change the palette view and display the subpalettes from the All Functions subpalette at the top level of the Functions palette. The All Functions subpalette contains all the VIs. they are located on the Numeric subpalette.Chapter 5 Using Other LabVIEW Features by functionality instead of having a subpalette for controls and a subpalette for indicators. 1. 2. of the LabVIEW User Manual for more information about using the complete set of built-in controls and indicators available in LabVIEW. and structures available in LabVIEW. Refer to Chapter 4. the top level of the Controls palette has a Numeric Controls subpalette and a Numeric Indicators subpalette. a stop button does not appear.

Select Advanced from the Palette View pull-down menu. You do not need to complete the following steps to change the palette view. Click the OK button to apply the changes. rather than a dialog box in which you can configure options. Refer to Chapter 7. most functions and VIs on the block diagram appear as icons that you cannot expand by default. You also can save the configuration of an Express VI as a subVI. front panel icons. 1. The upper right corner of the front panel and block diagram displays the icon for the VI. 2. VIs When you place a VI on the block diagram. LabVIEW considers the VI to be a subVI. of the LabVIEW User Manual for more information about creating subVIs from Express VIs. and other LabVIEW objects that also might look familiar. © National Instruments Corporation 5-3 Getting Started with LabVIEW . possibly subVIs. You can create a VI to use as a subVI. 3. Functions do not have front panels or block diagrams but do have connector panes. Functions Functions are the fundamental operating elements of LabVIEW. The front panel includes controls and indicators that might look familiar. Refer to Chapter 5. functions. Building the Block Diagram. icons for functions have pale yellow backgrounds. Unlike Express VIs. functions. This icon is the same as the icon that appears when you place the VI on the block diagram. a front panel and block diagram appear. of the LabVIEW User Manual for more information about creating VIs and configuring them as subVIs. Double-clicking a function only selects the function. When you double-click a subVI. on the Functions palette toolbar to display the Controls/Functions Palettes page of the Options dialog box. shown at left. and Express VIs.Chapter 5 Using Other LabVIEW Features the Functions palette. Click the Options button. and icons for Express VIs appear on the block diagram as expandable nodes with icons surrounded by a blue field. LabVIEW uses colored icons to distinguish between VIs. The block diagram includes wires. Icons for VIs have white backgrounds. Creating VIs and SubVIs.

notice that the terminals for the front panel objects are different colors. Refer to Chapter 5. For example. Notice the wires are of the same color as the terminal. Most other VIs and functions in LabVIEW do not accept the dynamic data type. waveform. The dynamic data type appears as a dark blue terminal. The colors also indicate the data types of the wires. A knob has an orange border so you can wire a knob to any input with an orange label. Wire the dynamic data type to an indicator that can best present the data. shown at left. chart. The color of the inputs and outputs on Express VIs indicate what type of data the input or output accepts or returns. and array data types for use with other VIs and functions. You can wire the dynamic data type to any indicator or input that accepts numeric. Data types indicate what objects. and an arrow appears on the left if the terminal is an indicator. Indicators include a graph. An arrow appears on the right if the terminal is a control. Converting from Dynamic Data Use the Convert from Dynamic Data Express VI to convert the dynamic data type to numeric. of the LabVIEW User Manual for more information about data types. waveform. the Configure Convert from Dynamic Getting Started with LabVIEW 5-4 ni. Dynamic Data Type The dynamic data type stores the information generated or acquired by an Express VI. you must convert the dynamic data type. you cannot wire a knob to an input with a green label.com . Building the Block Diagram. To use a built-in VI or function to analyze or process the data the dynamic data type includes. and outputs you can wire together. Most Express VIs accept and/or return the dynamic data type. a switch has a green border so you can wire a switch to any input with a green label on an Express VI. inputs. Also. Control terminals have a thicker border than indicator terminals. The color and symbol of each terminal indicate the data type of the control or indicator. When you place the Convert from Dynamic Data Express VI on the block diagram.Chapter 5 Using Other LabVIEW Features Data Types As you build the block diagram for a VI. and outputs. or numeric indicator. Boolean. arrows appear on front panel terminals to indicate whether the terminal is a control or an indicator. inputs. However. or Boolean data.

For example. select the 1D array of scalars – most recent values and Floating point numbers (double) options. select the Single waveform option on the Configure Convert to Dynamic Data dialog box. Converting to Dynamic Data Use the Convert to Dynamic Data Express VI to convert numeric. if you acquire a sine wave using the Analog Input VIs and want to use the Signal Analysis Express VIs to analyze the signal. the Configure Convert to Dynamic Data dialog box appears. Wire the Waveform output of the Convert from Dynamic Data Express VI to a function or VI that accepts the waveform data type. Boolean. The Configure Convert from Dynamic Data dialog box displays options that let you specify how you want to format the data that the Convert from Dynamic Data Express VI returns. waveform. Then wire the Dynamic Data Type output to an Express VI that accepts the dynamic data type as an input. When you wire a dynamic data type to an array indicator. © National Instruments Corporation 5-5 Getting Started with LabVIEW . Double-click the Convert from Dynamic Data Express VI to open the Configure Convert from Dynamic Data dialog box to control how the data appears in the array. if you acquired a sine wave from a data acquisition device. select the Single waveform option on the Configure Convert from Dynamic Data dialog box. Use this dialog box to select the kind of data to convert to the dynamic data type. and array data types to the dynamic data type for use with Express VIs. When you place the Convert to Dynamic Data Express VI on the block diagram. LabVIEW automatically places the Convert from Dynamic Data Express VI on the block diagram. If you acquired a collection of temperatures from different channels using a DAQ device.Chapter 5 Using Other LabVIEW Features Data dialog box appears. Then wire the Array output of the Convert from Dynamic Data Express VI to a function or VI that accepts a numeric array as an input. For example.

Call code from text-based languages—You can use LabVIEW to communicate with applications written in a text-based programming language.com . Refer to Chapter 18. in addition to the LabVIEW measurement data file format. You also can create custom menus. Calling Code from Text-Based Programming Languages. Refer to Chapter 14. of the LabVIEW User Manual for more information about these features. of the LabVIEW User Manual for more information about these features. Programatically Controlling VIs. 5. structures. 6. Customize Menus—You can configure which menu items appear when a user runs a VI. Refer to Chapter 17.Chapter 5 Using Other LabVIEW Features When to Use Other LabVIEW Features The Express VIs. Networking in LabVIEW. functions. VIs. Networking in LabVIEW. Publish VIs on the Web—You can publish the front panel of any VI you build to the Web. File I/O. Customizing VIs. structures. and controls and indicators located on the subpalettes at the top level of the Functions and Controls palettes provide the functionality you need to build common measurement applications. 4. Programatically controlling properties and methods for the LabVIEW environment. that other applications can use. of the LabVIEW User Manual for more information about these features. 1. controls. of the LabVIEW User Manual for more information about these features. such as C or C++. 2. of the LabVIEW User Manual for more information about these features. and controls and indicators—You can programatically control how a VI behaves when it is called or run. of the LabVIEW User Manual for more information about these features. Save data to a variety of file formats—You can create files. where users can interact with the front panel. The following list describes the applications that require you to use the VIs. Getting Started with LabVIEW 5-6 ni. Refer to Chapter 16. 3. or control how the LabVIEW environment behaves. Refer to Chapter 18. Communicate with other LabVIEW applications across a network—You can call a VI that resides on another computer running LabVIEW. Refer to Chapter 20. set the appearance of a control or indicator. and indicators located on the All Functions and All Controls subpalettes.

To learn more. call your local NI office or visit ni. instrument drivers. support phone numbers. conformity documentation. a measurement glossary. and so on.com/niglobal to access the branch office Web sites.com and could not find the answers you need. Our online system helps you define your question and connects you to the experts by phone. email addresses. hands-on courses at locations around the world. example code. visit our extensive library of technical support resources available in English. tutorials and application notes.com/support. videos. You also can register for instructor-led. step-by-step troubleshooting wizards. © National Instruments Corporation A-1 Getting Started with LabVIEW . System Integration—If you have time constraints.com for technical support and professional services: Support—Online technical support resources include the following: – Self-Help Resources—For immediate answers and solutions. discussion forum. Phone numbers for our worldwide offices are listed at the front of this manual. limited in-house technical resources.Technical Support and Professional Services • A Visit the following sections of the National Instruments Web site at ni. • If you searched ni. – • Training—Visit ni. and interactive CDs. which provide up-to-date contact information. discussion forums. a KnowledgeBase. or email. or other project challenges. You also can visit the Worldwide Offices section of ni. Japanese. and Spanish at ni. These resources are available for most products at no cost to registered users and include software drivers and updates. and current events.com/support. NI Alliance Program members can help. Assisted Support Options—Contact NI engineers and other measurement and automation professionals by visiting ni. product manuals.com/alliance. contact your local office or NI corporate headquarters.com/custed for self-paced tutorials.

Boolean controls and indicators broken Run button broken VI © National Instruments Corporation G-1 Getting Started with LabVIEW . autoscaling determines maximum and minimum scale values. signified by a broken arrow in the broken Run button. Button that replaces the Run button when a VI cannot run because of errors. Front panel objects to manipulate and display Boolean (TRUE or FALSE) data. B block diagram Pictorial description or representation of a program or algorithm.Glossary A autoscaling Ability of scales to adjust to the range of plotted values. The block diagram is the source code for the VI. On graph scales. The block diagram resides in the block diagram window of the VI. VI that cannot run because of errors. The block diagram consists of executable icons called nodes and wires that carry data between the nodes.

the type of measurement or generation. conditional terminal Context Help window control Controls palette current VI Getting Started with LabVIEW G-2 ni. A single physical channel can include more than one terminal. palettes. indicators. and scaling information. Objects with context help information include VIs. you can configure virtual channels either in MAX or in a program. Front panel object for entering data to a VI interactively or to a subVI programmatically. or dial. and you can configure channels as part of a task or separately. depending on the switch topology. The name used for a counter physical channel is an exception because that physical channel name is not the name of the terminal where the counter measures or generates the digital signal. and decorative objects. You can define NI-DAQmx virtual channels outside a task (global) or inside a task (local). 2.Glossary C channel 1. push button. Configuring virtual channels is optional in Traditional NI-DAQ and earlier versions. functions. Palette that contains front panel controls. VI whose front panel. Switch—a switch channel represents any connection point on a switch. or Icon Editor is the active window. In NI-DAQmx. you configure virtual channels in MAX. Checkboxes generally are associated with multiple options that you can set. two. constants. Window that displays basic information about LabVIEW objects when you move the cursor over each object. structures. input terminal connections. 3. properties.com . You can place a checkmark in more than one checkbox. In Traditional NI-DAQ. Switch channels may be used only in the NI-DAQmx Switch functions and VIs. a physical channel. block diagram. Terminal of a While Loop that contains a Boolean value that determines if the VI performs another iteration. Virtual—a collection of property settings that can include a name. methods. Physical—a terminal or pin at which you can measure or generate an analog or digital signal. checkbox Small square box in a dialog box you can place or remove checkmarks. and dialog box components. events. but is integral to every measurement you take in NI-DAQmx. A virtual channel cannot be created with a switch channel. as in the case of a differential analog input channel or a digital port of eight lines. It may be made up of one or more signal wires (commonly one. such as a knob. or four).

Glossary D DAQ DAQ Assistant DAQ device See data acquisition (DAQ). To acquire data and simultaneously store it in a disk file. path. waveform. data acquisition (DAQ) datalog data type default device drag driver © National Instruments Corporation G-3 Getting Started with LabVIEW . To use the cursor on the screen to select. A device that acquires or generates data and can contain multiple channels and conversion devices. DAQ devices include plug-in devices. copy. which connect to a computer USB or 1394 (FireWire) port. and test probes or fixtures. array. LabVIEW is a dataflow system. acquisition transducers. enumeration. and DAQPad devices. An instrument or controller you can access as a single entity that controls or monitors real-world I/O points. A graphical interface for configuring measurement tasks. refnum. Format for information. Software unique to the device or type of device that includes the set of commands the device accepts. In LabVIEW. LabVIEW file I/O VIs and functions can log data. acceptable data types for most VIs and functions are numeric. 1. SCXI modules are considered DAQ devices. and cluster. data flow Programming system that consists of executable nodes that execute only when they receive all required input data and produce output automatically when they execute. 2. and scales. move. string. Acquiring and measuring analog or digital electrical signals from sensors. See also DAQ device and measurement device. A device often is connected to a host computer through some type of communication network. Boolean. PCMCIA cards. Generating analog or digital electrical signals. channels. Many VI inputs use a default value if you do not specify a value. or delete objects. Preset value.

such as oscilloscopes and multimeters. A graph receives and plots data as a block. Palette that contains VIs. G graph 2D display of one or more plots. and/or data acquisition and control interfaces. comparable to an operator. icon indicator instrument driver iteration terminal Getting Started with LabVIEW G-4 ni. Front panel designs imitate physical instruments. and constants. F front panel function Functions palette Interactive user interface of a VI. A subVI designed to aid in common measurement tasks. or statement in a text-based programming language. such as a graph or LED. I I/O Input/Output. Graphical representation of a node on a block diagram.com . function. functions. The transfer of data to or from a computer system involving communications channels. operator input devices. A set of high-level functions that control and communicate with instrument hardware in a system. Terminal of a For Loop or While Loop that contains the current number of completed iterations. Built-in execution element. Front panel object that displays output. block diagram structures. You configure an Express VI using a configuration dialog box.Glossary E error message Express VI Indication of a software or hardware malfunction or of an unacceptable data entry attempt.

Horizontal bar that lists the names of the main menus of an application. a list of filenames on a disk. Laboratory Virtual Instrument Engineering Workbench. menu bar N NI-DAQ Driver software included with all NI measurement devices. to program all the features of an NI measurement device. SCXI signal conditioning modules. LabVIEW is a graphical programming language that uses icons instead of lines of text to create programs. although some menus and commands are common to many applications. Box within a dialog box that lists all available choices for a command. Light-emitting diode. Each application has a menu bar that is distinct for that application. and sending data to the device. acquiring and generating data from. such as LabVIEW. © National Instruments Corporation G-5 Getting Started with LabVIEW .Glossary L label LabVIEW Text object used to name or describe objects or regions on the front panel or block diagram. such as configuring. The menu bar appears below the titlebar of a window. Object a graph or chart owns to displays the names and plot styles of plots on that graph or chart. and switch modules. For example. NI-DAQ is an extensive library of VIs and functions you can call from an application development environment (ADE). LED legend listbox M measurement device DAQ devices such as the E Series multifunction I/O (MIO) devices.

node numeric controls and indicators O object Operating tool Generic term for any item on the front panel or block diagram. nodes. and development tools for controlling measurement devices. structures. Tool to move and resize objects. wires. P palette panel window plot Positioning tool pull-down menus Displays objects or tools you can use to build the front panel or block diagram. and subroutines in text-based programming languages. increased performance such as faster single-point analog I/O. structures. VI window that contains the front panel. Front panel objects to manipulate and display numeric data. functions. functions. operators. Program execution element. and Measurement Studio. Graphical representation of an array of data shown either on a graph or a chart. and imported pictures. Nodes are analogous to statements. indicators. and subVIs. Getting Started with LabVIEW G-6 ni. The advantages of NI-DAQmx over earlier versions of NI-DAQ include the DAQ Assistant for configuring channels and measurement tasks for your device for use in LabVIEW. On a block diagram. nodes include functions. Pull-down menu items are usually general in nature. and a simpler API for creating DAQ applications using fewer functions and VIs than earlier versions of NI-DAQ.Glossary NI-DAQmx The latest NI-DAQ driver with new VIs. the toolbar. and the icon and connector panes. Tool to enter data into controls operate them. including controls. LabWindows™/CVI™. Menus accessed from a menu bar.com .

triggering.Glossary S sample scale shortcut menu string structure subVI Single analog or digital input or output data point. which is not possible with NI-DAQ 6. Comparable to a subroutine. © National Instruments Corporation G-7 Getting Started with LabVIEW . usually on the Web. such as a Flat Sequence structure.9. For example. A task represents a measurement or generation you want to perform. T task A collection of one or more channels.ni. Program control element. Small yellow text banners that identify the terminal name and make it easier to identify terminals for wiring. or While Loop. Part of graph. Stacked Sequence structure. timing.9. VI used on the block diagram of another VI. Traditional NI-DAQ has the same VIs and functions and works the same way as NI-DAQ 6.x. terminal tip strip tool toolbar Traditional NI-DAQ U URL Uniform resource locator.com/ is the URL for the National Instruments Web site. Menu accessed by right-clicking an object. http://www. Case structure.x. A logical address that identifies a resource on a server. Object or region on a node through which data pass. Representation of a value as text. and other properties in NI-DAQmx. An upgrade to the earlier version of NI-DAQ. Menu items pertain to that object specifically. Bar that contains command buttons to run and debug VIs. For Loop. and some numeric controls and indicators that contains a series of marks or points at known intervals to denote units of measure. Special cursor to perform specific operations. You can use both Traditional NI-DAQ and NI-DAQmx on the same computer. chart.

Glossary

V
VI virtual instrument (VI) See virtual instrument (VI). Program in LabVIEW that models the appearance and function of a physical instrument.

W
waveform waveform chart While Loop wire wire branch Multiple voltage readings taken at a specific sampling rate. Indicator that plots data points at a certain rate. Loop structure that repeats a section of code until a condition is met. Data path between nodes. Section of wire that contains all the wire segments from junction to junction, terminal to junction, or terminal to terminal if there are no junctions between. Point where three or more wire segments join. Single horizontal or vertical piece of wire. Tool to define data paths between terminals.

wire junction wire segment Wiring tool

Getting Started with LabVIEW

G-8

ni.com

Index
Symbols
.lvm file, 2-9, 2-14

A
Abort Execution button, 1-8 acquiring information for instruments, 4-7 signals, 4-1 adding controls, 3-4 controls to front panel, 1-4 graph indicator, 3-4 inputs to Express VIs, 1-6, 2-11, 3-4 new channels to tasks, 4-5 numeric indicators, 3-4 outputs to Express VIs, 2-11 visual cues on front panel, 2-6 warning light, 2-6 All Controls palette, 5-1 changing palette view, 5-2 All Functions palette, 5-2 changing palette view, 5-2 Amplitude and Level Measurements Express VI, 2-2 analyzing voltage, 2-5 analyzing signals, 2-5 Arithmetic & Comparison palette, 1-9

broken Run button, 2-4 wires, 2-4, 2-14 Build Table Express VI, 3-7 button Abort Execution, 1-8 place on block diagram, 3-9 Run, 1-4

C
calling code from text-based languages, 5-6 changing palette views, 5-2 signal type, 1-5 channels, 4-2 adding to tasks, 4-5 renaming, 4-4 communicating with instruments, 4-6, 4-9 with LabVIEW applications across networks, 5-6 Comparison Express VI setting warning level, 2-7 configuration dialog box, 1-17 contacting National Instruments, A-1 Context Help window, 2-2, 2-13, 3-2, 3-9 button, 3-2 display configuration of Express VI, 2-2 displaying errors, 2-14 controlling execution speed, 3-6, 3-10 controls, 1-16, 2-13 adding, 3-4 adding to front panel, 1-4 all, 5-1 configuring, 1-16

B
block diagram, 1-4, 1-17 indicators, 2-13 modifying, 2-3 show, 1-5

© National Instruments Corporation

I-1

Getting Started with LabVIEW

Index

creating, 3-4, 3-9 customizing, 1-12 data type, 5-4 numeric, 1-5 palette, 1-4 Controls palette, 1-4 changing palette views, 5-2 conventions used in this manual, ix Convert from Dynamic Data Type Express VI, 5-4 Convert to Dynamic Data Type Express VI, 5-5 creating controls, 3-4, 3-9 graph indicator, 3-4 indicators, 3-9 NI-DAQmx tasks, 4-2 customer education, A-1 professional services, A-1 technical support, A-1 customizing block diagrams, 3-9 controls, 1-12 front panel, 3-4 indicators, 1-14 menus, 5-6 simulated signal, 2-3

displaying data from DAQ devices, 4-4 data in tables, 3-7, 3-10 signals in a graph, 1-11 documentation conventions used in this manual, ix introduction to this manual, ix online library, A-1 drivers, 4-6, 4-9 instrument, 4-6, 4-9, A-1 software, A-1 dynamic data type, 5-4 converting from, 5-4 converting to, 5-5

E
Error list window, 2-4, 2-14 errors, 2-14 displaying, 2-4 displaying in Context Help window, 2-14 list, 2-4, 2-14 window, 2-4, 2-14 example code, A-1 example VIs NI Example Finder, 5-1 Execution Control palette, 3-5, 3-10 execution speed controlling, 3-6 Express VI Convert to Dynamic Data Type, 5-5 Express VIs, 1-17 Amplitude and Level Measurements, 2-2, 2-5 Build Table, 3-7 Comparison, 2-7 configuration dialog box, 1-17 Convert from Dyanmic Data Type, 5-4 DAQ Assistant, 4-2, 4-8 dynamic data type, 5-4 inputs, 1-17

D
DAQ Assistant Express VI, 4-2, 4-8 DAQ device, 4-2 data flow, 1-7, 1-11, 1-17 data type dynamic, 5-4 data types, 5-4 deleting wires, 1-9 deselecting objects, 1-7 diagnostic resources, A-1

Getting Started with LabVIEW

I-2

ni.com

4-4 two signals. A-1 I indicators. 4-6. 2-14 LabVIEW Help. 3-9 LEDs. 1-9 changing palette views. 1-16 modifying. 3-4 Functions palette. 1-17 Sample Compression. 1-16 adding controls. 2-13 adding numeric. 1-4. 1-14 data type. 2-4 Input palette. 5-4 removing. 3-2. 4-9. 2-4 show. 2-13. 3-9 searching for Express VI. 2-6 H help button. 3-2 instrument drivers. 1-12 merge signals. 1-16 creating. 1-5 Time Delay. 5-3 all. 3-3 LabVIEW help resources using. 4-6. 4-9 parsing information. 5-2 Merge Signals. 3-4 graphing data from DAQ devices. 2-13. 4-6 F frequently asked questions. 3-9 customizing. 3-4 all.Index Instrument I/O Assistant. 1-11 L LabVIEW dialog box. 2-5. 2-13 customizing. A-1 Instrument I/O Assistant Express VI. 1-4 controls. 3-9 professional services. 3-4 indicators. 3-9 LabVIEW resources. 2-9. 4-6. 1-16. 2-13. 4-9 outputs. 3-9 © National Instruments Corporation I-3 Getting Started with LabVIEW . 4-7 communicating. 1-2. 3-6 Write LabVIEW Measurement File. A-1 G graph indicator adding. 3-4 creating. 4-6. 1-16. 2-6 LEDs palette palette. 1-8 functions. A-1 technical support. 1-9 Simulate Signals. 2-2 LabVIEW Help. 2-2. A-1 front panel. 4-7 selecting. 5-1 configuring. 2-5 Context Help window. 3-3 Scaling and Mapping. 5-2 K KnowledgeBase. 2-13. 4-9 instruments acquiring information.

5-1 NI Instrument Driver Network. 1-5 changing palette views. 5-2 Arithmetic & Comparison. 3-7 parsing information for instruments. A-1 technical support. 1-8 continuously. 3-2 Numeric Controls. 1-7 selecting. 2-9. 1-4 broken. 1-16 publishing VIs on the Web. 5-6 to files. 4-2. 1-9 Getting Started with LabVIEW I-4 ni. A-1 programatically controlling VIs. A-1 professional services. 1-7 online technical support. 4-6. 2-10 Scaling and Mapping Express VI. 3-5. 3-3 saving data to different file formats. 4-9 NI-DAQmx creating tasks. 4-2 tasks. 1-12. 3-5 O objects deselecting. 1-7 professional services. 1-10 selecting instruments. 3-7 Merge Signals function. A-1 system integration services. 5-1 All Functions. 3-10 Functions. A-1 place on block diagram. 1-7 P palettes All Controls. 2-3 front panel. 2-14 running. 2-14 when prompted by user. 1-16. A-1 property dialog boxes. 5-2 Controls. 3-3 N National Instruments customer education. See documentation marquee. 2-2 NI Example Finder. 1-8 running VIs. 4-8 testing tasks. 1-9.com . 5-6 R Run button. A-1 New dialog box. 1-4 Execution Control. 1-9 Input. 3-9 positioning tool. 5-6 programming examples. 3-4 modifying block diagram. A-1 operating tool. 1-9 define slope. 1-8 S Sample Compression Express VI. 1-5 Text Indicators. 1-2. A-1 worldwide offices.Index M manual. 2-4. 4-4 Numeric Controls palette. 4-7 phone technical support. 2-4 signals. 4-6 objects.

5-1 icons. 1-2. 3-1 customizing menus. A-1 technical support. 1-1 all. 3-10 tasks adding new channels. 1-8 Positioning. 4-5 NI-DAQmx. 5-6 Time Delay Express VI. 3-7 text-based languages calling code. A-1 V virtual instruments. 1-1. A-1 template VIs. 5-3 new. 1-5 sine wave. 1-16 T table. 4-4 technical support. 1-7 training customer. 5-6 running. A-1 support technical. 3-6 tools Operating. 3-7 displaying data. 4-8 testing. A-1 Write LabVIEW Measurement File saving data. 2-9 Write LabVIEW Measurement File Express VI. 1-5 software drivers. 1-8 subVIs. 1-2. 1-16 blank. See VIs VIs. 3-3 Simulate Signal Express VI. 1-7 worldwide technical support. 2-9. A-1 system integration services. 1-9 wiring objects on block diagram. 5-6 examples. 1-9. 1-7 Wiring. A-1 troubleshooting resources. 4-1 analyzing. A-1 While Loop. 3-2 programmatically controlling. 5-6 publishing on the Web. 5-2 blank. 5-3 template. 2-14 U user interface. See front panel © National Instruments Corporation I-5 Getting Started with LabVIEW .Index signals acquiring. A-1 telephone technical support. 3-2 building. 2-5 changing type. 3-6 wires broken. 3-1. 1-5 modifying. 2-14 deleting. A-1 W Web professional services. 1-7 Text Indicators palette. 2-4. 1-7 tool. 2-1. 3-1 terminals.

Sign up to vote on this title
UsefulNot useful