Labview Tutorial
Labview Tutorial
User Manual
LabVIEW User Manual
TM
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 (Qubec) 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 [email protected]. 19922003 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. CUSTOMERS 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 owners failure to follow the National Instruments installation, operation, or maintenance instructions; owners modification of the product; owners 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, DataSocket, DIAdem, IMAQ, IVI, LabVIEW, Measurement Studio, National Instruments, NI, ni.com, NI-DAQ, NI Developer Zone, NI-IMAQ, NI-VISA, NI-VXI, and SCXI are trademarks of National Instruments Corporation. 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: HelpPatents in your software, the patents.txt file on your CD, or ni.com/patents.
Contents
About This Manual
Organization of This Manual .........................................................................................xxi Conventions ...................................................................................................................xxii
Contents
Toolbar ............................................................................................................ 3-4 Context Help Window................................................................................................... 3-4 Customizing Your Work Environment ......................................................................... 3-5 Customizing the Controls and Functions Palettes........................................... 3-6 Adding VIs and Controls to the User and Instrument Drivers Subpalettes ..................................................................................... 3-6 Creating and Editing Custom Palette View ...................................... 3-6 How LabVIEW Stores Views ............................................ 3-7 Building ActiveX Subpalettes .......................................................... 3-7 Representing Toolsets and Modules in the Palettes ......................... 3-8 Setting Work Environment Options................................................................ 3-8 How LabVIEW Stores Options ........................................................ 3-8 Windows............................................................................. 3-8 Mac OS............................................................................... 3-8 UNIX.................................................................................. 3-9
vi
ni.com
Contents
Graphs and Charts ...........................................................................................4-12 Buttons, Switches, and Lights .........................................................................4-12 Text Entry Boxes, Labels, and Path Displays .................................................4-13 String Controls and Indicators ..........................................................4-13 Combo Box Controls ........................................................................4-13 Path Controls and Indicators .............................................................4-14 Invalid Paths .......................................................................4-14 Empty Paths ........................................................................4-14 Array and Cluster Controls and Indicators......................................................4-14 Listboxes, Tree Controls, and Tables ..............................................................4-15 Listboxes ...........................................................................................4-15 Tree Controls.....................................................................................4-15 Tables ................................................................................................4-16 Ring and Enumerated Type Controls and Indicators ......................................4-16 Ring Controls ....................................................................................4-17 Enumerated Type Controls ...............................................................4-17 Advanced Enumerated Type Controls and Indicators ........4-18 Container Controls...........................................................................................4-18 Tab Controls......................................................................................4-18 Subpanel Controls .............................................................................4-19 I/O Name Controls and Indicators...................................................................4-20 Waveform Control ............................................................................4-21 Digital Waveform Control ................................................................4-21 Digital Data Control..........................................................................4-21 Converting Data to Digital Data .........................................4-22 Acquiring a Digital Subset .................................................4-23 Appending Digital Samples and Signals ............................4-24 Compressing Digital Data ..................................................4-24 Searching for a Pattern .......................................................4-24 References to Objects or Applications ............................................................4-25 Dialog Controls and Indicators........................................................................4-25 Labeling .........................................................................................................................4-26 Captions...........................................................................................................4-27 Text Characteristics .......................................................................................................4-27 Designing User Interfaces..............................................................................................4-28 Using Front Panel Controls and Indicators .....................................................4-29 Designing Dialog Boxes..................................................................................4-29 Selecting the Screen Size.................................................................................4-30
vii
Contents
viii
ni.com
Contents
Block Diagram Data Flow .............................................................................................5-25 Data Dependency and Artificial Data Dependency.........................................5-26 Missing Data Dependencies..............................................................5-27 Data Flow and Managing Memory..................................................................5-27 Designing the Block Diagram........................................................................................5-28
ix
Contents
ni.com
Contents
Auto-Indexing Loops.......................................................................................8-4 Auto-Indexing to Set the For Loop Count ........................................8-4 Auto-Indexing with While Loops .....................................................8-5 Using Loops to Build Arrays...........................................................................8-5 Shift Registers and the Feedback Node in Loops............................................8-6 Shift Registers ...................................................................................8-6 Stacked Shift Registers .....................................................................8-7 Replacing Shift Registers with Tunnels............................................8-7 Replacing Tunnels with Shift Registers............................................8-8 Feedback Node ................................................................................................8-8 Initializing Feedback Nodes..............................................................8-10 Replacing Shift Registers with a Feedback Node.............................8-10 Controlling Timing..........................................................................................8-10 Case and Sequence Structures .......................................................................................8-11 Case Structures ................................................................................................8-11 Case Selector Values and Data Types...............................................8-11 Input and Output Tunnels .................................................................8-12 Using Case Structures for Error Handling ........................................8-13 Sequence Structures.........................................................................................8-13 Flat Sequence Structure ....................................................................8-13 Stacked Sequence Structure ..............................................................8-13 Using Sequence Structures................................................................8-14 Avoiding Overusing Sequence Structures ........................................8-15 Replacing Sequence Structures.........................................................8-16
xi
Contents
xii
ni.com
Contents
xiii
Contents
Picture Functions VIs .................................................................................................... 13-4 Creating and Modifying Colors with the Picture Functions VIs .................... 13-6 Graphics Formats VIs.................................................................................................... 13-6 Sound VIs ...................................................................................................................... 13-7
xiv
ni.com
Contents
xv
Contents
Dynamically Loading and Calling VIs.......................................................................... 17-7 Call By Reference Nodes and Strictly Typed VI Refnums ............................ 17-7 Editing and Running VIs on Remote Computers .......................................................... 17-8 Controlling Front Panel Objects.................................................................................... 17-8 Strictly Typed and Weakly Typed Control Refnums...................................... 17-9
xvi
ni.com
Contents
Low-Level Communications Applications ....................................................................18-19 TCP and UDP ..................................................................................................18-19 Apple Events and PPC Toolbox (Mac OS) .....................................................18-20 Pipe VIs (UNIX)..............................................................................................18-20 Executing System-Level Commands (Windows and UNIX)..........................18-20
xvii
Contents
xviii
ni.com
Contents
Comparing Arrays and Clusters.....................................................................................C-2 Arrays ..............................................................................................................C-2 Compare Elements Mode..................................................................C-2 Compare Aggregates Mode ..............................................................C-3 Clusters ............................................................................................................C-3 Compare Elements Mode..................................................................C-3 Compare Aggregates Mode ..............................................................C-3
xix
You can access the PDFs from the LabVIEW Help, but you must install the PDFs to do so. Refer to the LabVIEW Documentation Resources section of Chapter 1, Introduction to LabVIEW, for information about accessing the PDFs in the LabVIEW Bookshelf.
xxi
Conventions
The following conventions appear in this manual: The symbol leads you through nested menu items and dialog box options to a final action. The sequence FilePage SetupOptions directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a tip, which alerts you to advisory information. This icon denotes a note, which alerts you to important information. This icon denotes a caution, which advises you of precautions to take to avoid injury, data loss, or a system crash. bold Bold text denotes items that you must select or click in the software, such as menu items and dialog box options. Bold text also denotes parameter names, controls and buttons on the front panel, dialog boxes, sections of dialog boxes, menu names, and palette names. Italic text denotes variables, emphasis, a cross reference, or an introduction to a key concept. This font also denotes text that is a placeholder for a word or value that you must supply. Text in this font denotes text or characters that you should enter from the keyboard, sections of code, programming examples, and syntax examples. This font is also used for the proper names of disk drives, paths, directories, programs, subprograms, subroutines, device names, functions, operations, variables, filenames and extensions, and code excerpts. Bold text in this font denotes the messages and responses that the computer automatically prints to the screen. This font also emphasizes lines of code that are different from the other examples. Italic text in this font denotes text that is a placeholder for a word or value that you must supply. Text in this font denotes a specific platform and indicates that the text following it applies only to that platform.
(Mac OS) Press <Command>-click to perform the same action as a
italic
monospace
monospace bold
monospace italic
Platform
right-click
right-click.
xxii
ni.com
Part I
LabVIEW Concepts
This part describes programming concepts for building applications in LabVIEW. The chapters in this section introduce you to the LabVIEW programming environment and help you plan your application. Part I, LabVIEW Concepts, contains the following chapters: Chapter 1, Introduction to LabVIEW, describes LabVIEW, its extensive documentation, and tools to help you design and build VIs. Chapter 2, Introduction to Virtual Instruments, describes the components of virtual instruments, or VIs. Chapter 3, LabVIEW Environment, describes the LabVIEW palettes, tools, and menus you use to build the front panels and block diagrams of VIs. This chapter also describes how to customize the LabVIEW palettes and set several work environment options. Chapter 4, Building the Front Panel, describes how to build the front panel of a VI. Chapter 5, Building the Block Diagram, describes how to build the block diagram of a VI. Chapter 6, Running and Debugging VIs, describes how to configure how a VI runs and to identify problems with block diagram organization or with the data passing through the block diagram. Chapter 7, Creating VIs and SubVIs, describes how to create your own VIs and subVIs, distribute VIs, and build stand-alone applications and shared libraries.
I-1
Introduction to LabVIEW
LabVIEW is a graphical programming language that uses icons instead of lines of text to create applications. In contrast to text-based programming languages, where instructions determine program execution, LabVIEW uses dataflow programming, where the flow of data determines execution. In LabVIEW, you build a user interface with a set of tools and objects. The user interface is known as the front panel. You then add code using graphical representations of functions to control the front panel objects. The block diagram contains this code. In some ways, the block diagram resembles a flowchart. You can purchase several add-on software toolsets for developing specialized applications. All the toolsets integrate seamlessly in LabVIEW. Refer to the National Instruments Web site at ni.com for more information about these toolsets.
1-1
Chapter 1
Introduction to LabVIEW
LabVIEW User ManualUse this manual to learn about LabVIEW programming concepts, techniques, features, VIs, and functions you can use to create test and measurement, data acquisition, instrument control, datalogging, measurement analysis, and report generation applications. LabVIEW HelpUse this help file as a reference for information about LabVIEW palettes, menus, tools, VIs, and functions. The LabVIEW Help also includes step-by-step instructions for using LabVIEW features. Access the LabVIEW Help by selecting Help VI, Function, and How-To Help. The LabVIEW Help includes links to the following resources: LabVIEW Bookshelf, which includes PDF versions of all the LabVIEW manuals and Application Notes Technical support resources on the National Instruments Web site, such as the NI Developer Zone, the KnowledgeBase, and the Product Manuals Library
Note (Mac OS and UNIX) National Instruments recommends that you use Netscape 6.0 or later or Internet Explorer 5.0 or later to view the LabVIEW Help.
LabVIEW Measurements ManualUse this manual to learn more about building data acquisition and instrument control applications in LabVIEW. If you are a new LabVIEW user, read the Getting Started with LabVIEW manual and the LabVIEW User Manual before you read this manual. LabVIEW Application Builder User GuideUse this document to learn about the LabVIEW Application Builder, which is included in the LabVIEW Professional Development System and is available for purchase separately. This user guide contains instructions for installing the Application Builder, describes system requirements for applications, and describes the changes introduced between previous versions and the current version. This user guide also describes caveats and recommendations to consider when you build a VI into an application or shared library. LabVIEW Development GuidelinesUse this manual to learn how to build VIs that are easy to understand, use, and revise. This manual describes project tracking, design, and documentation techniques. This manual also contains recommended style guidelines.
1-2
ni.com
Chapter 1
Introduction to LabVIEW
Note
The printed LabVIEW Development Guidelines manual is available only in the LabVIEW Professional Development System. The PDF is available in all packages of LabVIEW. LabVIEW Analysis ConceptsUse this manual to learn about the analysis concepts used by LabVIEW. This manual includes information about signal generation, the fast Fourier transform (FFT) and the discrete Fourier transform (DFT), smoothing windows, curve fitting, linear algebra, fundamental concepts of probability and statistics, and point-by-point analysis for real-time analysis.
Note
The LabVIEW Analysis Concepts manual is available only as a PDF. Using External Code in LabVIEWUse this manual to learn how to use Code Interface Nodes and external subroutines to import code written in text-based programming languages. The manual includes information about calling DLLs, shared external subroutines, libraries of functions, memory and file manipulation routines, and diagnostic routines.
Note
The Using External Code in LabVIEW manual is available only as a PDF. LabVIEW Release NotesUse these release notes to install and uninstall LabVIEW. The release notes also describe the system requirements for the LabVIEW software and known issues with LabVIEW. LabVIEW Upgrade NotesUse these upgrade notes to upgrade LabVIEW for Windows, Mac OS, and UNIX to the latest version. The upgrade notes also describe new features and issues you might encounter when you upgrade. LabVIEW Application NotesUse the LabVIEW Application Notes to learn about advanced or specialized LabVIEW concepts and applications. Refer to the NI Developer Zone at ni.com/zone for new and updated Application Notes. LabVIEW VXI VI Reference ManualUse this manual to learn about the VXI VIs for LabVIEW. This manual is a companion guide to the NI-VXI Programmer Reference Manual that comes with the VXI hardware. National Instruments recommends using VISA technology for configuring, programming, and troubleshooting instrumentation systems consisting of VXI hardware.
Note
1-3
Chapter 1
Introduction to LabVIEW
LabVIEW Tools
LabVIEW includes many tools to help you quickly configure your measurement devices. You can access the following tools from the Tools menu.
(Windows) Measurement & Automation Explorer (MAX) helps you
DAQ channels.
(Mac OS 9 or earlier) The DAQ Solution Wizard helps you find solutions
for common DAQ applications. You can choose from example VIs or create custom VIs.
1-4
ni.com
Chapter 1
Introduction to LabVIEW
Use the DAQ Assistant to graphically configure channels or common measurement tasks. You can access the DAQ Assistant in the following ways: Place the DAQ Assistant Express VI on the block diagram. Right-click a DAQmx Global Channel control and select New Channel (DAQ Assistant) from the shortcut menu. Right-click a DAQmx Task Name control and select New Task (DAQ Assistant) from the shortcut menu. Right-click a DAQmx Scale Name control and select New Scale (DAQ Assistant) from the shortcut menu. Launch Measurement & Automation Explorer and select Data Neighborhood or Scales from the Configuration tree. Click the Create New button. Configure a NI-DAQmx channel, task, or scale.
Refer to the LabVIEW Measurements Manual for more information about using the DAQ Assistant.
1-5
LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate physical instruments, such as oscilloscopes and multimeters. Every VI uses functions that manipulate input from the user interface or other sources and display that information or move it to other files or other computers. A VI contains the following three components: Front panelServes as the user interface. Block diagramContains the graphical source code that defines the functionality of the VI. Icon and connector paneIdentifies the VI so that you can use the VI in another VI. A VI within another VI is called a subVI. A subVI corresponds to a subroutine in text-based programming languages.
For more information Refer to the LabVIEW Help for more information about creating VIs and subVIs.
Front Panel
The front panel is the user interface of the VI. Figure 2-1 shows an example of a front panel.
2-1
Chapter 2
You build the front panel with controls and indicators, which are the interactive input and output terminals of the VI, respectively. Controls are knobs, push buttons, dials, and other input devices. Indicators are graphs, LEDs, and other displays. Controls simulate instrument input devices and supply data to the block diagram of the VI. Indicators simulate instrument output devices and display data the block diagram acquires or generates. Refer to Chapter 4, Building the Front Panel, for more information about the front panel.
Block Diagram
After you build the front panel, you add code using graphical representations of functions to control the front panel objects. The block diagram contains this graphical source code. Front panel objects appear as terminals on the block diagram. Refer to Chapter 5, Building the Block Diagram, for more information about the block diagram.
2-2
ni.com
Chapter 2
The VI in Figure 2-2 shows several primary block diagram objectsterminals, functions, and wires.
Terminals
The terminals represent the data type of the control or indicator. You can configure front panel controls or indicators to appear as icon or data type terminals on the block diagram. By default, front panel objects appear as icon terminals. For example, a knob icon terminal shown at left, represents a knob on the front panel. The DBL at the bottom of the terminal represents a data type of double-precision, floating-point numeric. A DBL terminal, shown at left, represents a double-precision, floating-point numeric control or indicator. Refer to the Control and Indicator Data Types section of Chapter 5, Building the Block Diagram, for more information about data types in LabVIEW and their graphical representations. Terminals are entry and exit ports that exchange information between the front panel and block diagram. Data you enter into the front panel controls (a and b in Figure 2-2) enter the block diagram through the control terminals. The data then enter the Add and Subtract functions. When the Add and Subtract functions complete their internal calculations, they produce new data values. The data flow to the indicator terminals, where they exit the block diagram, reenter the front panel, and appear in front panel indicators (a+b and a-b in Figure 2-2).
2-3
Chapter 2
Nodes
Nodes are objects on the block diagram that have inputs and/or outputs and perform operations when a VI runs. They are analogous to statements, operators, functions, and subroutines in text-based programming languages. The Add and Subtract functions in Figure 2-2 are nodes. Refer to the Block Diagram Nodes section of Chapter 5, Building the Block Diagram, for more information about nodes.
Wires
You transfer data among block diagram objects through wires. In Figure 2-2, wires connect the control and indicator terminals to the Add and Subtract functions. Each wire has a single data source, but you can wire it to many VIs and functions that read the data. Wires are different colors, styles, and thicknesses, depending on their data types. A broken wire appears as a dashed black line with a red X in the middle. Refer to the Using Wires to Link Block Diagram Objects section of Chapter 5, Building the Block Diagram, for more information about wires.
Structures
Structures are graphical representations of the loops and case statements of text-based programming languages. Use structures on the block diagram to repeat blocks of code and to execute code conditionally or in a specific order. Refer to Chapter 8, Loops and Structures, for examples and more information about structures.
2-4
ni.com
Chapter 2
inputs and outputs you can wire to the VI so you can use it as a subVI. A connector pane receives data at its input terminals and passes the data to the block diagram code through the front panel controls and receives the results at its output terminals from the front panel indicators. When you view the connector pane for the first time, you see a connector pattern. You can select a different pattern if you want to. The connector pane generally has one terminal for each control or indicator on the front panel. You can assign up to 28 terminals to a connector pane. If you anticipate changes to the VI that would require a new input or output, leave extra terminals unassigned. Refer to the Setting up the Connector Pane section of Chapter 7, Creating VIs and SubVIs, for more information about setting up connector panes.
Note
Try not to assign more than 16 terminals to a VI. Too many terminals can reduce the readability and usability of the VI.
2-5
LabVIEW Environment
Use the LabVIEW palettes, tools, and menus to build the front panels and block diagrams of VIs. You can customize the Controls and Functions palettes, and you can set several work environment options.
For more information Refer to the LabVIEW Help for more information about using the palettes, menus, and toolbar, and customizing your work environment.
Controls Palette
The Controls palette is available only on the front panel. The Controls palette contains the controls and indicators you use to create the front panel. The controls and indicators are located on subpalettes based on the types of controls and indicators. Refer to the Front Panel Controls and Indicators section of Chapter 4, Building the Front Panel, for more information about the types of controls and indicators. The controls and indicators located on the Controls palette depend on the palette view currently selected. Refer to the Creating and Editing Custom Palette View section of this chapter for more information about palette views. Select WindowShow Controls Palette or right-click the front panel workspace to display the Controls palette. You can place the Controls palette anywhere on the screen. LabVIEW retains the Controls palette position and size so when you restart LabVIEW, the palette appears in the same position and has the same size. You can change the way the Controls palette appears. Refer to the Customizing the Controls and Functions Palettes section of this chapter for more information about customizing the Controls palette.
Functions Palette
The Functions palette is available only on the block diagram. The Functions palette contains the VIs and functions you use to build the block
3-1
Chapter 3
LabVIEW Environment
diagram. The VIs and functions are located on subpalettes based on the types of VIs and functions. Refer to the Functions Overview section of Chapter 5, Building the Block Diagram, for more information about the types of VIs and functions. The VIs and functions located on the Functions palette depend on the palette view currently selected. Refer to the Creating and Editing Custom Palette View section of this chapter for more information about palette views. Select WindowShow Functions Palette or right-click the block diagram workspace to display the Functions palette. You can place the Functions palette anywhere on the screen. LabVIEW retains the Functions palette position and size so when you restart LabVIEW, the palette appears in the same position and has the same size. You can change the way the Functions palette appears. Refer to the Customizing the Controls and Functions Palettes section of this chapter for more information about customizing the Functions palette.
3-2
ni.com
Chapter 3
LabVIEW Environment
Tools Palette
The Tools palette is available on the front panel and the block diagram. A tool is a special operating mode of the mouse cursor. The cursor corresponds to the icon of the tool selected in the palette. Use the tools to operate and modify front panel and block diagram objects. Select WindowShow Tools Palette to display the Tools palette. You can place the Tools palette anywhere on the screen. LabVIEW retains the Tools palette position so when you restart LabVIEW, the palette appears in the same position.
Tip
Press the <Shift> key and right-click to display a temporary version of the Tools palette at the location of the cursor. If automatic tool selection is enabled and you move the cursor over objects on the front panel or block diagram, LabVIEW automatically selects the corresponding tool from the Tools palette. You can disable automatic tool selection by clicking the Automatic Tool Selection button on the Tools palette, shown at left. Press the <Shift-Tab> keys or click the Automatic Tool Selection button to enable automatic tool selection again. You also can disable automatic tool selection by manually selecting a tool on the Tools palette. Press the <Tab> key or click the Automatic Tool Selection button on the Tools palette to enable automatic tool selection again.
Menus
The menus at the top of a VI window contain items common to other applications, such as Open, Save, Copy, and Paste, and other items specific to LabVIEW. Some menu items also list shortcut key combinations.
(Mac OS) The menus appear at the top of the screen. (Windows and UNIX) The menus display only the most recently used items by
default. Click the arrows at the bottom of a menu to display all items.You can display all menu items by default by selecting ToolsOptions and selecting Miscellaneous from the top pull-down menu.
3-3
Chapter 3
LabVIEW Environment
Note
Shortcut Menus
The most often-used menu is the object shortcut menu. All LabVIEW objects and empty space on the front panel and block diagram have associated shortcut menus. Use the shortcut menu items to change the look or behavior of front panel and block diagram objects. To access the shortcut menu, right-click the object, front panel, or block diagram.
Toolbar
Use the toolbar buttons to run and edit a VI. When you run a VI, buttons appear on the toolbar that you can use to debug the VI.
3-4
ni.com
Chapter 3
LabVIEW Environment
You can place the Context Help window anywhere on the screen. The Context Help window resizes to accommodate each object description. You also can resize the Context Help window to set its maximum size. LabVIEW retains the Context Help window position and size so when you restart LabVIEW, the window appears in the same position and has the same maximum size. You can lock the current contents of the Context Help window so the contents of the window do not change when you move the cursor over different objects. Select HelpLock Context Help to lock or unlock the current contents of the Context Help window. You also can lock or unlock the contents of the window by clicking the Lock button in the Context Help window, shown at left, or by pressing the <Ctrl-Shift-L> keys. (Mac OS) Press the <Command-Shift-L> keys. (UNIX) Press the <Alt-Shift-L> keys. Click the Show Optional Terminals and Full Path button in the Context Help window, shown at left, to display the optional terminals of a connector pane and to display the full path to a VI. Refer to the Setting Required, Recommended, and Optional Inputs and Outputs section of Chapter 7, Creating VIs and SubVIs, for more information about optional terminals. If a corresponding LabVIEW Help topic exists for an object the Context Help window describes, a blue Click here for more help. link appears in the Context Help window. Also, the More Help button in the Context Help window, shown at left, is enabled. Click the link or the button to display the LabVIEW Help for more information about the object. Refer to the Creating VI and Object Descriptions section of Chapter 15, Documenting and Printing VIs, for information about creating descriptions to display in the Context Help window.
3-5
Chapter 3
LabVIEW Environment
Caution
Do not save your own VIs and controls in the vi.lib directory because LabVIEW overwrites these files when you upgrade or reinstall. Save your VIs and controls in the user.lib directory to add them to the Functions and Controls palettes.
Adding VIs and Controls to the User and Instrument Drivers Subpalettes
The simplest method for adding VIs and controls to the Functions and Controls palettes is to save them in the labview\user.lib directory. When you restart LabVIEW, the User Libraries and User Controls palettes contain subpalettes for each directory, VI library (.llb), or menu (.mnu) file in labview\user.lib and icons for each file in labview\ user.lib. After you add files to or remove files from specific directories, LabVIEW automatically updates the palettes when you restart LabVIEW. The Instrument Drivers palette corresponds to the labview\instr.lib directory. Save instrument drivers in this directory to add them to the Functions palette. When you add VIs or controls to the Functions and Controls palettes using this method, you cannot set the name of each subpalette or the exact location of the VIs or controls on the palettes.
3-6
ni.com
Chapter 3
LabVIEW Environment
viewsExpress and Advanced. Select ToolsAdvancedEdit Palette Views to create or edit custom palette views.
Note
You cannot edit a built-in palette view. LabVIEW stores Controls and Functions palette information in the labview\menus directory. The menus directory contains directories that correspond to each view that you create or install. If you run LabVIEW on a network, you can define individual menus directories for each user, which makes it easy to transfer views to other users. When you create a new view of a palette, LabVIEW uses a copy of the original built-in view, upon which you can apply any changes. LabVIEW copies the original built-in palette located in the labview\menus directory before you make any changes. The protection of the built-in palettes ensures that you can experiment with the palettes without corrupting the original view.
3-7
Chapter 3
LabVIEW Environment
Windows
LabVIEW stores options in a labview.ini file in the LabVIEW directory. The file format is similar to other .ini files. It begins with a LabVIEW section marker followed by the option name and the values, such as offscreenUpdates=True. If you want to use a different options file, specify the file in the shortcut you use to start LabVIEW. For example, to use an options file on your computer named lvrc instead of labview.ini, right-click the LabVIEW icon on the desktop and select Properties. Click the Shortcut tab and type labview -pref lvrc in the Target text box.
Mac OS
LabVIEW stores options in the LabVIEW Preferences text file in the SystemPreferences folder.
3-8
ni.com
Chapter 3
LabVIEW Environment
If you want to use a different options file, copy the LabVIEW Preferences file to the LabVIEW folder and make options changes in the Options dialog box. When you launch LabVIEW, it first looks for an options file in the LabVIEW folder. If it does not find the file there, it looks in the System folder. If it does not find the file there, it creates a new one in the System folder. LabVIEW writes all changes you make in the Options dialog box to the first LabVIEW Preferences file it finds.
UNIX
LabVIEW stores options in the .labviewrc file in your home directory. If you change an option in the Options dialog box, LabVIEW writes the change to the .labviewrc file. You can create a labviewrc file in the program directory to store options that are the same for all users, such as the VI search path. Use the .labviewrc file to store options that are different for each user, such as font or color settings, because entries in the .labviewrc file in your home directory override conflicting entries in the program directory. For example, if you installed the LabVIEW files in /opt/labview, LabVIEW first reads options from /opt/labview/labviewrc. If you change an option in the Options dialog box, such as the application font, LabVIEW writes that change to the .labviewrc file. The next time you start LabVIEW, it uses the application font option in the .labviewrc file instead of the default application font defined in /opt/labview/ labviewrc. Option entries consist of an option name followed by a colon and a value. The option name is the executable followed by a period (.) and an option. When LabVIEW searches for option names, the search is case sensitive. You can enclose the option value in double or single quotation marks. For example, to use a default precision of double, add the following entry to the .labviewrc file in your home directory.
labview.defPrecision : double
If you want to use a different options file, specify the file on the command line when you start LabVIEW. For example, to use a file named lvrc in the test directory instead of .labviewrc, type labview -pref /test/lvrc. LabVIEW writes all changes you make in the Options dialog box to the lvrc options file. When you specify an options file on the command line, LabVIEW still reads the labviewrc file in the program directory, but the options file specified on the command line overrides conflicting entries in the program directory.
3-9
The front panel is the user interface of a VI. Generally, you design the front panel first, then design the block diagram to perform tasks on the inputs and outputs you create on the front panel. Refer to Chapter 5, Building the Block Diagram, for more information about the block diagram. You build the front panel with controls and indicators, which are the interactive input and output terminals of the VI, respectively. Controls are knobs, push buttons, dials, and other input devices. Indicators are graphs, LEDs, and other displays. Controls simulate instrument input devices and supply data to the block diagram of the VI. Indicators simulate instrument output devices and display data the block diagram acquires or generates. Select WindowShow Controls Palette to display the Controls palette, then select controls and indicators from the Controls palette and place them on the front panel.
For more information Refer to the LabVIEW Help for more information about designing and configuring the front panel.
4-1
Chapter 4
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. You cannot access property dialog boxes for a control or indicator while a VI runs.
4-2
ni.com
Chapter 4
be broken. For example, if you replace a numeric terminal with a string terminal, the original wire remains on the block diagram, but is broken. The more the new object resembles the object you are replacing, the more original characteristics you can preserve. For example, if you replace a slide with a different style slide, the new slide has the same height, scale, value, name, description, and so on. If you replace the slide with a string control instead, LabVIEW preserves only the name, description, and dataflow direction because a slide does not have much in common with a string control. You also can paste objects from the clipboard to replace existing front panel controls and indicators. This method does not preserve any characteristics of the old object, but the wires remain connected to the object.
LabVIEW does not respond to keyboard shortcuts for hidden controls. When a user enters the keyboard shortcut while running the VI, the associated control receives the focus. If the control is a text or digital control, LabVIEW highlights the text so you can edit it. If the control is Boolean, press the spacebar or the <Enter> key to change its value. The AdvancedKey Navigation shortcut menu item is dimmed for indicators because you cannot enter data in an indicator.
Note
You also can use the Key Down event to generate an event when the user presses a specific key on the keyboard.
4-3
Chapter 4
Refer to the Key Navigation section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about setting keyboard shortcuts in a user interface.
4-4
ni.com
Chapter 4
Coloring Objects
You can change the color of many objects but not all of them. For example, block diagram terminals of front panel objects and wires use specific colors for the type and representation of data they carry, so you cannot change them. Use the Coloring tool to right-click an object or workspace to change the color of front panel objects or the front panel and block diagram workspaces. You also can change the default colors for most objects by selecting ToolsOptions and selecting Colors from the top pull-down menu. Refer to the Colors section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about using color to design a user interface.
loses any transparency. Refer to the examples\general\controls\custom.llb for examples of controls with imported graphics. Refer to the Graphics and Custom Controls section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about using graphics to design a user interface.
4-5
Chapter 4
You also can use the alignment grid on the block diagram. Select ToolsOptions and select Alignment Grid from the top pull-down menu to hide or customize the grid. To align objects after you place them, select the objects and select the Align Objects pull-down menu on the toolbar. To space objects evenly, select the objects and select the Distribute Objects pull-down menu on the toolbar.
Resizing Objects
You can change the size of most front panel objects. When you move the Positioning tool over a resizable object, resizing handles or circles appear at the points where you can resize the object. When you resize an object, the font size remains the same. Resizing a group of objects resizes all the objects within the group. Some objects change size only horizontally or vertically when you resize them, such as digital numeric controls and indicators. Others keep the same proportions when you resize them, such as knobs. The Positioning cursor appears the same, but the dashed border that surrounds the object moves in only one direction.
4-6
ni.com
Chapter 4
You can manually restrict the growth direction when you resize an object. To restrict the growth vertically or horizontally or to maintain the current proportions of the object, press the <Shift> key while you click and drag the resizing handles or circles. To resize an object around its center point, press the <Ctrl> key while you click and drag the resizing handles or circles.
(Mac OS) Press the <Option> key. (Sun) Press the <Meta> key. (Linux) Press
the <Alt> key. To resize multiple objects to the same size, select the objects and select the Resize Objects pull-down menu on the toolbar.You can resize all the selected objects to the width or height of the largest or smallest object, and you can resize all the selected objects to a specific size in pixels.
4-7
Chapter 4
When LabVIEW scales objects automatically, it follows the same conventions as when you resize an object manually. For example, some objects can resize only horizontally or vertically, and the font size remains the same when you resize an object. After LabVIEW automatically scales an object, the object might not scale back to its exact original size when you size the window back to its original position. Before you save the VI, select EditUndo to restore the original front panel window and object sizes. You can set an array to scale or set the objects within an array to scale. If you set the array to scale, you adjust the number of rows and columns you can see within the array. If you set the objects within the array to scale, you always see the same number of rows and columns, though different sizes, within the array. You also can set a cluster to scale or set the objects within the cluster to scale. If you set the objects within the cluster to scale, the cluster adjusts as well.
4-8
ni.com
Chapter 4
the <Alt> key. A rectangle marked by a dashed border defines where space will be inserted. Release the key combination to add the space.
4-9
Chapter 4
4-10
ni.com
Chapter 4
Numeric Formatting
By default, LabVIEW displays and stores numbers like a calculator. A numeric control or indicator displays up to six digits before automatically switching to exponential notation. You can configure the number of digits LabVIEW displays before switching to exponential notation in the Format and Precision tab of the Numeric Properties dialog box. The precision you select affects only the display of the value. The internal accuracy still depends on the representation.
Color Boxes
A color box displays a color that corresponds to a specified value. For example, you can use color boxes to indicate different conditions, such as
4-11
Chapter 4
out-of-range values. The color value is expressed as a hexadecimal number with the form RRGGBB. The first two digits control the red color value. The second two digits control the green color value. The last two digits control the blue color value. Set the color of the color box by clicking it with the Operating or Coloring tool to display the color picker.
Color Ramps
A color ramp uses color to display its numeric value. You configure a color ramp that consists of at least two arbitrary markers, each with a numeric value and a corresponding display color. As the input value changes, the color displayed changes to the color that corresponds to that value. Color ramps are useful for visually indicating data ranges, such as a warning range for when a gauge reaches dangerous values. For example, you can use a color ramp to set the color scale for intensity charts and graphs. Refer to the Intensity Graphs and Charts section of Chapter 12, Graphs and Charts, for more information about intensity charts and graphs. Right-click the color ramp and use the shortcut menu items to customize the appearance, size, colors, and number of colors. You also can add a color ramp to any knob, dial, or gauge on the front panel. Meters have a visible color ramp by default.
4-12
ni.com
Chapter 4
4-13
Chapter 4
undefined string values, LabVIEW does not accept or display the letters you type in the control. When you configure the list of strings for a combo box control, you can specify a custom value for each string, which is useful if you want the string that appears in the combo box control on the front panel to be different than the string value the combo box terminal on the block diagram returns. Right-click the combo box control, select Edit Items from the shortcut menu, and remove the checkmark from the Values Match Labels checkbox in the Edit Items page of the Combo Box Properties dialog box. In the Values column of the table in this dialog box, change the value that corresponds to each string in the control.
Invalid Paths
If a function that returns a path fails, the function returns an invalid path value, <Not A Path>, in the indicator. Use the <Not A Path> value as the default value for a path control to detect when the user fails to provide a path and display a file dialog box with options for selecting a path. Use the File Dialog function to display a file dialog box.
Empty Paths
An empty path in a path control appears as an empty string on Windows and Mac OS and as a slash (/) on UNIX. Use empty paths to prompt the user to specify a path. When you wire an empty path to a file input/output (I/O) function, the empty path refers to the list of drives mapped to the computer.
(Mac OS) The empty path refers to the mounted volumes. (UNIX) The empty
4-14
ni.com
Chapter 4
and Clusters section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about arrays and clusters. The Array & Cluster palettes also contain standard error cluster controls and indicators and the variant control. Refer to the Error Clusters section of Chapter 6, Running and Debugging VIs, for more information about error clusters. Refer to the Handling Variant Data section of Chapter 5, Building the Block Diagram, for more information about the variant control.
Listboxes
You can configure listboxes to accept single or multiple selections. Use the multicolumn listbox to display more information about each item, such as the size of the item and the date it was created. When you type characters in a listbox at run time, LabVIEW selects the first item in the listbox that begins with the characters you type. Use the left and right arrow keys to go to the previous or next items that match the characters you type. You can add a symbol next to a list item, such as in the VI Library Manager dialog box, where directories and files have different symbols. You also can insert separator lines between list items. You can use a Property Node to modify list items and to gather information about list items, such as to detect the currently selected items or to detect which items, if any, the user double-clicked. Refer to the Property Nodes section of Chapter 17, Programmatically Controlling VIs, for more information about Property Nodes.
Tree Controls
Use the tree control to give users a hierarchical list of items from which to select. You organize the items you enter in the tree control into groups of items, or nodes. Click the expand symbol next to a node to expand it and display all the items in that node. You also click the symbol next to the node to collapse the node.
4-15
Chapter 4
Note
You can create and edit tree controls only in the LabVIEW Full and Professional Development Systems. If a VI contains a tree control, you can run the VI in all LabVIEW packages, but you cannot configure the control in the Base Package. When you type characters in a tree control at run time, LabVIEW selects the first item in the tree control that begins with the characters you type. You can change the hierarchy of items in the tree control by selecting an item and pressing the period (.) key to indent the current item or the comma (,) key to move the current item to the left. You configure items in a tree control the same way you configure them in a listbox. You also can change the type of symbol that appears next to each node, and you can configure whether the user can drag items within the tree control. You can use an Invoke Node to modify items in the tree control and to gather information about items, such as to detect which items, if any, the user double-clicked. When you add an item in the tree control, LabVIEW creates a unique tag for the item. You use this tag to modify items or to gather information about items programmatically. Right-click the tree control and select Edit Items from the shortcut menu to modify the tags that LabVIEW creates for each item. Refer to the Invoke Nodes section of Chapter 17, Programmatically Controlling VIs, for more information about Invoke Nodes. Refer to the Directory Hierarchy in Tree Control VI in the examples\ general\controls\Directory Tree Control.llb for an example of using a tree control.
Tables
Use the table control located on the List & Table and Classic List & Table palettes to create a table on the front panel. Refer to the Tables section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about using table controls.
4-16
ni.com
Chapter 4
Ring Controls
Ring controls are numeric objects that associate numeric values with strings or pictures. Ring controls appear as pull-down menus that users can cycle through to make selections. Ring controls are useful for selecting mutually exclusive items, such as trigger modes. For example, use a ring control for users to select from continuous, single, and external triggering. Right-click a ring control and select Edit Items from the shortcut menu to add items to the list from which you can select in the control. The order of the items in the Edit Items page of the Ring Properties dialog box determines the order of the items in the control. You also can configure the ring control so users can enter numeric values not already associated with any entries in the list of items defined for the control by right-clicking the ring control and select Allow Undefined Values from the shortcut menu. To enter an undefined value in the ring control at run time, click the control, select <Other> from the shortcut menu, enter a numeric value in the digital display that appears, and press the <Enter> key. The undefined value appears in the ring control in angle brackets. LabVIEW does not add the undefined value to the list of items from which you can select in the control. When you configure the list of items for a ring control, you can assign a specific numeric value to each item. If you do not assign specific numeric values to the items, LabVIEW assigns sequential values that correspond to the order of the items in the list, starting with a value of 0 for the first item. To assign specific numeric values, right-click the ring control, select Edit Items from the shortcut menu, and remove the checkmark from the Sequential Values checkbox in the Edit Items page of the Ring Properties dialog box. In the Values section of the table in this dialog box, change the numeric values that correspond to each item in the control. Each item in the ring control must have a unique numeric value.
You cannot allow the user to enter undefined values in enumerated type controls, and you cannot assign specific numeric values to items in enumerated type controls. If you need
4-17
Chapter 4
this functionality, use a ring control. Refer to the Ring Controls section of this chapter for more information about ring controls. You can use an enumerated type control to select the cases of a Case structure. Refer to the Case Structures section of Chapter 8, Loops and Structures, for more information about Case structures. The numeric representation of the enumerated type control is an 8-bit, 16-bit, or 32-bit unsigned integer. Right-click the enumerated type control and select Representation from the shortcut menu to change the representation of the control.
Container Controls
Use the container controls located on the Containers and the Classic Containers palettes to group controls and indicators, to display the front panel of another VI on the front panel of the current VI, or (Windows) to display ActiveX objects on the front panel. Refer to Chapter 19, Windows Connectivity, of this manual for more information about using ActiveX.
Tab Controls
Use tab controls to overlap front panel controls and indicators in a smaller area. A tab control consists of pages and tabs. Place front panel objects on
4-18
ni.com
Chapter 4
each page of a tab control and use the tab as the selector for displaying different pages. Tab controls are useful when you have several front panel objects that are used together or during a specific phase of operation. For example, you might have a VI that requires the user to first configure several settings before a test can start, then allows the user to modify aspects of the test as it progresses, and finally allows the user to display and store only pertinent data. On the block diagram, the tab control is an enumerated type control by default. Terminals for controls and indicators placed on the tab control appear as any other block diagram terminal. Refer to the Enumerated Type Controls section of this chapter for more information about enumerated type controls.
Subpanel Controls
Use the subpanel control to display the front panel of another VI on the front panel of the current VI. For example, you can use a subpanel control to design a user interface that behaves like a wizard. Place the Back and Next buttons on the front panel of the top-level VI and use a subpanel control to load different front panels for each step of the wizard.
Note
You can create and edit subpanel controls only in the LabVIEW Full and Professional Development Systems. If a VI contains a subpanel control, you can run the VI in all LabVIEW packages, but you cannot configure the control in the Base Package. When you place a subpanel control on the front panel, LabVIEW does not create a front panel terminal for the control on the block diagram. Instead, LabVIEW creates an Invoke Node on the block diagram with the Insert VI method selected. To load a VI in the subpanel control, wire a reference to that VI to the Invoke Node. Refer to Chapter 17, Programmatically Controlling VIs, of this manual for more information about using VI references and Invoke Nodes.
Note
Because the subpanel control does not have a terminal, you cannot create an array of subpanel controls, and you cannot create a type definition of a subpanel control. You can place a subpanel control in a cluster to group the subpanel control with other controls, but the cluster cannot contain only a subpanel control or controls. If the front panel of the VI you want to load is open or if you loaded the front panel in another subpanel control on the same front panel, LabVIEW returns an error, and you cannot load the front panel in the subpanel control.
4-19
Chapter 4
You also cannot load the front panel of a VI in a remote instance of LabVIEW, and you cannot load front panels recursively. You cannot use keyboard shortcuts to navigate or operate the front panel in the subpanel control. If you load a VI that is not running, the VI in the subpanel control loads in run mode. LabVIEW displays only the visible area of the front panel of the VI you load in the subpanel control. After you stop the VI that contains the subpanel control, LabVIEW clears the front panel in the subpanel control. You also can use the Remove VI method to unload the VI in the subpanel control. Refer to the examples\general\controls\subpanel.llb for examples of using subpanel controls.
4-20
ni.com
Chapter 4
The IMAQ session control is a unique identifier that represents the connection to the hardware.
Waveform Control
Use the waveform control to manipulate individual data elements of a waveform. Refer to the Waveform Data Type section of Chapter 12, Graphs and Charts, for more information about the waveform data type.
2 3 5
4
1 2 Signals Data 3 4 Vertical Scroll Bar Samples 5 Horizontal Scroll Bar
4-21
Chapter 4
You can insert and delete rows and columns in the digital data control. To insert a row, right-click a sample in the sample column and select Insert Row Before from the shortcut menu. To delete a row, right-click a sample in the sample column and select Delete Row from the shortcut menu. To insert a column, right-click a signal in the signal column and select Insert Column Before from the shortcut menu. To delete a column, right-click a signal in the signal column and select Delete Column from the shortcut menu. You also can cut, copy, and paste digital data within the control. To cut data, select the row or column you want to cut, right-click, and select Data OperationsCut Data from the shortcut menu. You can cut only whole rows or columns of data. You cannot create a new row or column with the digital data you cut. To copy data, select the area you want to copy, right-click, and select Data OperationsCopy Data from the shortcut menu. To paste digital data, select the area you want to copy into and select Data OperationsPaste Data from the shortcut menu. You must paste digital data into an area that is the same dimension as the area you cut or copied from. For example, if you copy four bits of data from one row, you must select four existing bits of data to paste over in the same row or in a different row. If you copy four bits of data from an area of two rows by two columns, you must paste the data into an area of two rows by two columns. The digital data control and the digital waveform control accept values of 0, 1, L, H, Z, X, T, and V. You can display the data in the digital data control in binary, hexadecimal, octal, and decimal formats. The digital states L, H, Z, X, T, and V, which are states some measurement devices use, appear as question marks if you choose to display the values in hexadecimal, octal, or decimal format. Right-click the control, select Data Format from the shortcut menu, and select a data format for the control.
4-22
ni.com
Chapter 4
minimum value of 5 and a maximum value of 5. The Digital Waveform probe displays a portion of the resulting values in binary format.
4-23
Chapter 4
The top Digital Signal Subset VI extracts the first and second signals from the digital waveform. The bottom Digital Signal Subset VI extracts the fourth and fifth signals. The Append Digital Samples VI appends the first signal to the fourth signal, appends the second signal to the fifth signal, and plots the resulting two signals on a digital waveform graph.
4-24
ni.com
Chapter 4
4-25
Chapter 4
platform, the dialog controls adapt their color and appearance to match the standard dialog box controls for that platform. Select FileVI Properties and select Window Appearance from the Category pull-down menu to hide the menu bar and scrollbars and to create VIs that look and behave like standard dialog boxes for each platform. Select Editor Options from the Category pull-down menu to change the style of control or indicator LabVIEW creates when you right-click a terminal and select CreateControl or CreateIndicator from the shortcut menu. Select ToolsOptions and select Front Panel from the top pull-down menu to change the style of control or indicator LabVIEW creates in new VIs when you right-click a terminal and select Create Control or CreateIndicator from the shortcut menu. Refer to the Configuring the Appearance and Behavior of VIs section of Chapter 16, Customizing VIs, for more information about configuring the appearance and behavior of VIs.
Labeling
Use labels to identify objects on the front panel and block diagram. LabVIEW includes two kinds of labelsowned labels and free labels. Owned labels belong to and move with a particular object and annotate that object only. You can move an owned label independently, but when you move the object that owns the label, the label moves with the object. You can hide owned labels, but you cannot copy or delete them independently of their owners. You also can display a unit label for numeric controls and indicators by selecting Visible ItemsUnit Label from the shortcut menu. Refer to the Numeric Units and Strict Type Checking section of Chapter 5, Building the Block Diagram, for more information about numeric units. Free labels are not attached to any object, and you can create, move, rotate, or delete them independently. Use them to annotate front panels and block diagrams. Free labels are useful for documenting code on the block diagram and for listing user instructions on the front panel. Double-click an open space or use the Labeling tool to create free labels or to edit either type of label. Refer to the Labels section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about creating descriptive labels for a user interface.
4-26
ni.com
Chapter 4
Captions
Front panel objects also can have captions. Right-click the object and select Visible ItemsCaption from the shortcut menu to display the caption. Unlike a label, a caption does not affect the name of the object, and you can use it as a more descriptive object label. The caption does not appear on the block diagram. If you assign the object to a connector pane terminal, the caption appears when you use the Wiring tool to move the cursor over the terminal on the block diagram. The caption also appears next to the terminal in the Context Help window. Refer to the Setting up the Connector Pane section of Chapter 7, Creating VIs and SubVIs, for more information about connector pane terminals.
Text Characteristics
LabVIEW uses fonts already installed on your computer. Use the Text Settings pull-down menu on the toolbar to change the attributes of text. If you select objects or text before you make a selection from the Text Settings pull-down menu, the changes apply to everything you select. If you select nothing, the changes apply to the default font. Changing the default font does not change the font of existing labels. It affects only those labels you create from that point on. Select Font Dialog from the Text Settings pull-down menu on the front panel to apply specific font styles to text you have selected. If you do not select any text, the Panel Default option contains a checkmark. If you select Text SettingsFont Dialog from the block diagram without selecting any objects, the Diagram Default option contains a checkmark. You can set different fonts for the front panel and for the block diagram. For example, you can have a small font on the block diagram and a large one on the front panel. The Text Settings pull-down menu contains the following built-in fonts: Application FontDefault font used for Controls and Functions palettes and text in new controls System FontUsed for menus Dialog FontUsed for text in dialog boxes
When you transfer a VI that contains one of these built-in fonts to another platform, the fonts correspond as closely as possible.
4-27
Chapter 4
The Text Settings pull-down menu also has Size, Style, Justify, and Color submenu items. Font selections you make from any of these submenus apply to objects you selected. For example, if you select a new font while you have a knob and a graph selected, the labels, scales, and digital displays all change to the new font. LabVIEW preserves as many font attributes as possible when you make a change. For example, if you change several objects to the Courier font, the objects retain their size and styles if possible. When you use the Font dialog box, LabVIEW changes the objects you select to the text characteristics you select. If you select one of the built-in fonts or the current font, LabVIEW changes the selected objects to the font and size associated with that font. When you work with objects that have multiple pieces of text, like slides, font changes you make affect the objects or text you currently have selected. For example, if you select the entire slide and select StyleBold from the Text Settings pull-down menu, the scale, digital display, and label all change to a bold font. If you select only the label and select Bold, only the label changes to a bold font. If you select text from a scale marker and select Bold, all the markers change to a bold font. Refer to the Fonts and Text Characteristics section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about using fonts and text characteristics to design a user interface.
4-28
ni.com
Chapter 4
4-29
Chapter 4
Guidelines manual for more information about using dialog boxes in a user interface.
4-30
ni.com
After you build the front panel, you add code using graphical representations of functions to control the front panel objects. The block diagram contains this graphical source code.
For more information Refer to the LabVIEW Help for more information about designing and configuring the block diagram.
5-1
Chapter 5
A DBL terminal, shown at left, represents a double-precision, floating-point numeric control or indicator. Right-click a terminal and select Display Icon from the shortcut menu to remove the checkmark and to display the data type for the terminal. Use icon terminals to display the types of front panel objects on the block diagram, in addition to the data types of the front panel objects. Use data type terminals to conserve space on the block diagram.
Note
Icon terminals are larger than data type terminals, so you might unintentionally obscure other block diagram objects when you convert a data type terminal to an icon terminal. A terminal is any point to which you can attach a wire, other than to another wire. LabVIEW has control and indicator terminals, node terminals, constants, and specialized terminals on structures, such as the input and output terminals on the Formula Node. You use wires to connect terminals and pass data to other terminals. Right-click a block diagram object and select Visible ItemsTerminals from the shortcut menu to view the terminals. Right-click the object and select Visible ItemsTerminals again to hide the terminals. This shortcut menu item is not available for expandable VIs and functions.
Control
Indicator
Data Type Single-precision floating-point numeric Double-precision floating-point numeric Extended-precision floating-point numeric Complex single-precision floating-point numeric
5-2
ni.com
Chapter 5
Control
Indicator
Data Type Complex double-precision floating-point numeric Complex extended-precision floating-point numeric 8-bit signed integer numeric 16-bit signed integer numeric 32-bit signed integer numeric 8-bit unsigned integer numeric 16-bit unsigned integer numeric 32-bit unsigned integer numeric <64.64>-bit time stamp
Color Orange Orange Blue Blue Blue Blue Blue Blue Brown
Default Values 0.0 + i0.0 0.0 + i0.0 0 0 0 0 0 0 date and time (local) FALSE empty string
Enumerated type Boolean String ArrayEncloses the data type of its elements in square brackets and takes the color of that data type. ClusterEncloses several data types. Cluster data types are brown if all elements of the cluster are numeric or pink if the elements of the cluster are different types. Path Dynamic
Brown or Pink
Aqua Blue
<Not A Path>
5-3
Chapter 5
Control
Indicator
Data Type WaveformCluster of elements that carries the data, start time, and t of a waveform. Refer to the Waveform Data Type section of Chapter 12, Graphs and Charts, for more information about the waveform data type. Digital waveform Digital data Reference number (refnum) VariantStores the control or indicator name, information about the data type from which you converted, and the data itself. Refer to the Handling Variant Data section of this chapter for more information about the variant data type. I/O namePasses DAQ channel names, VISA resource names, and IVI logical names you configure to I/O VIs to communicate with an instrument or a DAQ device. Refer to the I/O Name Controls and Indicators section of Chapter 4, Building the Front Panel, for more information about the I/O name data type. PictureDisplays pictures that can contain lines, circles, text, and other types of graphic shapes. Refer to the Using the Picture Indicator section of Chapter 13, Graphics and Sound VIs, for more information about the picture data type.
Color Brown
Default Values
Purple
Blue
Many data types have a corresponding set of functions that can manipulate the data. Refer to the Functions Overview section of this chapter for information about which functions to use with each data type. Refer to the Memory and Speed Optimization section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about selecting a data type to optimize memory usage.
5-4
ni.com
Chapter 5
Constants
Constants are terminals on the block diagram that supply fixed data values to the block diagram. Universal constants are constants with fixed values, such as pi () and infinity (). User-defined constants are constants you define and edit before you run a VI. Label a constant by right-clicking the constant and selecting Visible ItemsLabel from the shortcut menu. Universal constants have predetermined values for their labels that you can edit by using the Operating tool or the Labeling tool. Most constants are located at the bottom or top of their palettes.
Universal Constants
Use universal constants for mathematical computations and formatting strings or paths. LabVIEW includes the following types of universal constants: Universal numeric constantsA set of high-precision and commonly used mathematical and physical values, such as the natural logarithm base (e) and the speed of light. The universal numeric constants are located on the Additional Numeric Constants palette. Universal string constantsA set of commonly used non-displayable string characters, such as line feed and carriage return. The universal string constants are located on the String palette. Universal file constantsA set of commonly used file path values, such as Not a Path, Not a Refnum, and Default Directory. The universal file constants are located on the File Constants palette.
User-Defined Constants
The Functions palette includes constants organized by type, such as Boolean, numeric, ring, enumerated type, color box, string, array, cluster, and path constants. Create a user-defined constant by right-clicking an input terminal of a VI or function and selecting Create Constant from the shortcut menu. You cannot change the value of user-defined constants when the VI is running. You also can create a constant by dragging a front panel control to the block diagram. LabVIEW creates a constant that contains the value of the front panel control at the time you dragged it to the block diagram. The front panel control remains on the front panel. Changing the value of the control does not affect the constant value and vice versa.
5-5
Chapter 5
Use the Operating or Labeling tool to click the constant and edit its value. If automatic tool selection is enabled, double-click the constant to switch to the Labeling tool and edit the value.
5-6
ni.com
Chapter 5
Languages, for more information about calling code from text-based programming languages. Call By Reference NodesStructures for calling a dynamically loaded VI. Refer to the Call By Reference Nodes and Strictly Typed VI Refnums section of Chapter 17, Programmatically Controlling VIs, for more information about using Call By Reference Nodes. Call Library NodesStructures for calling most standard shared libraries or DLLs. Refer to the Call Library Function Node section of Chapter 20, Calling Code from Text-Based Programming Languages, for more information about using Call Library Nodes.
Functions Overview
Functions are the essential operating elements of LabVIEW. Function icons on the Functions palette have pale yellow backgrounds and black foregrounds. Functions do not have front panels or block diagrams but do have connector panes. You cannot open nor edit a function. The Functions palette also includes the VIs that ship with LabVIEW. Use these VIs as subVIs when you build data acquisition, instrument control, communication, and other VIs. Refer to the Using Built-In VIs and Functions section of Chapter 7, Creating VIs and SubVIs, for more information about using the built-in VIs.
Numeric Functions
Use the Numeric functions to create and perform arithmetic, trigonometric, logarithmic, and complex mathematical operations on numbers and to convert numbers from one data type to another.
Boolean Functions
Use the Boolean functions to perform logical operations on single Boolean values or arrays of Boolean values, such as the following tasks: Change a TRUE value to a FALSE value and vice versa. Determine which Boolean value to return if you receive two or more Boolean values. Convert a Boolean value to a number (either 1 or 0). Perform compound arithmetic on two or more Boolean values.
5-7
Chapter 5
String Functions
Use the String functions to perform the following tasks: Concatenate two or more strings. Extract a subset of strings from a string. Search for and replace characters or subsets of strings in a string. Convert numeric data into strings. Format a string for use in a word processing or spreadsheet application.
Refer to the Strings section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about using the String functions.
Array Functions
Use the Array functions to create and manipulate arrays, such as the following tasks: Extract individual data elements from an array. Add individual data elements to an array. Split arrays.
Refer to the Arrays section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about using the Array functions.
Cluster Functions
Use the Cluster functions to create and manipulate clusters, such as the following tasks: Extract individual data elements from a cluster. Add individual data elements to a cluster. Break a cluster out into its individual data elements.
Refer to the Clusters section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about using the Cluster functions.
5-8
ni.com
Chapter 5
Comparison Functions
Use the Comparison functions to compare Boolean values, strings, numerics, arrays, and clusters. Refer to Appendix C, Comparison Functions, for more information about using the Comparison functions.
The Time & Dialog palette also includes the Error Handler VIs. Refer to the Error Checking and Error Handling section of Chapter 6, Running and Debugging VIs, for more information about using the Error Handler VIs.
The File I/O palette also includes VIs that perform common file I/O tasks. Refer to Chapter 14, File I/O, for more information about using the File I/O VIs and functions.
Waveform Functions
Use the Waveform functions to perform the following tasks: Build waveforms that include the waveform values, channel information, and timing information. Extract individual data elements from a waveform. Edit individual data elements of a waveform.
5-9
Chapter 5
Refer to Chapter 5, Creating a Typical Measurement Application, of the LabVIEW Measurements Manual for more information about creating and using waveforms in VIs.
Advanced Functions
Use the Advanced functions to call code from libraries, such as dynamic link libraries (DLLs), to manipulate LabVIEW data for use in other applications, to create and manipulate Windows registry keys, and to call a section of code from text-based programming languages. Refer to the Using External Code in LabVIEW manual for more information about using the Advanced functions.
5-10
ni.com
Chapter 5
5-11
Chapter 5
1 3
2
1 Segment 2 Bend 3 Junction
While you are wiring a terminal, bend the wire at a 90 degree angle once by moving the cursor in either a vertical or horizontal direction. To bend a wire in multiple directions, click the mouse button to set the wire and then move the cursor in the new direction. You can repeatedly set the wire and move it in new directions. To undo the last point where you set the wire, press the <Shift> key and click anywhere on the block diagram.
(Mac OS) Press the <Option> key and click. (UNIX and Linux) Click the middle mouse button.
When you cross wires, a small gap appears in the first wire you drew to indicate that the first wire is under the second wire.
Caution
Crossing wires can clutter a block diagram and make the block diagram difficult to debug. Refer to the Wiring Techniques section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about wiring tips and techniques.
5-12
ni.com
Chapter 5
As you move a selected object close to other objects on the block diagram, LabVIEW draws temporary wires to show you valid connections. When you release the mouse button to place the object on the block diagram, LabVIEW automatically connects the wires. Toggle automatic wiring by pressing the space bar while you move an object using the Positioning tool. By default, automatic wiring is enabled when you select an object from the Functions palette or when you copy an object already on the block diagram by pressing the <Ctrl> key and dragging the object. Automatic wiring is disabled by default when you use the Positioning tool to move an object already on the block diagram.
(Mac OS) Press the <Option> key. (Sun) Press the <Meta> key. (Linux) Press
the <Alt> key. You can disable automatic wiring by selecting ToolsOptions and selecting Block Diagram from the top pull-down menu.
5-13
Chapter 5
Routing Wires
LabVIEW automatically finds a route for a wire as you wire it. LabVIEW routes a wire around existing objects on the block diagram, such as loops and structures. LabVIEW also routes a wire to decrease the number of bends in the wire. When possible, automatically routed wires from control terminals exit the right side of the terminal, and automatically routed wires to indicator terminals enter the left side of the terminal. To automatically route an existing wire, right-click the wire and select Clean Up Wire from the shortcut menu. Press the <A> key after you start a wire to temporarily disable automatic wire routing and route a wire manually. Press the <A> key again to enable automatic wire routing for the wire. After you end the wire, LabVIEW enables automatic wire routing again. You also can temporarily disable automatic routing after you click to start or set a wire by holding down the mouse button while you wire to another terminal or set point and then releasing the mouse button. After you release the mouse button, LabVIEW enables automatic wire routing again. You can disable automatic wire routing for all new wires by selecting ToolsOptions and selecting Block Diagram from the top pull-down menu. If you disable automatic wire routing, you can wire terminals vertically or horizontally depending on the direction in which you first move the Wiring tool. The wire connects to the center of the terminal, regardless of where you click the terminal. After you click the terminal, press the spacebar to switch between the horizontal and vertical direction. You also can press the spacebar to switch between the horizontal and vertical direction if automatic wire routing is enabled. If LabVIEW finds a route for the wire in the new direction, the wire switches to that direction.
Selecting Wires
Select wires by using the Positioning tool to single-click, double-click, or triple-click them. Single-clicking a wire selects one segment of the wire. Double-clicking a wire selects a branch. Triple-clicking a wire selects the entire wire.
Chapter 5
two objects with incompatible data types. Move the Wiring tool over a broken wire to display a tip strip that describes why the wire is broken. This information also appears in the Context Help window when you move the Wiring tool over a broken wire. Right-click the wire and select List Errors from the shortcut menu to display the Error list window. Click the Help button for more information about why the wire is broken. Triple-click the wire with the Positioning tool and press the <Delete> key to remove a broken wire. You also can right-click the wire and select from shortcut menu options such as Delete Wire Branch, Create Wire Branch, Remove Loose Ends, Clean Up Wire, Change to Control, Change to Indicator, Enable Indexing at Source, and Disable Indexing at Source. These options change depending on the reason for the broken wire. You can remove all broken wires by selecting EditRemove Broken Wires or by pressing the <Ctrl-B> keys. (Mac OS) Press the <Command-B> keys. (UNIX) Press the <Meta-B> keys.
Caution
Use caution when removing all broken wires. Sometimes a wire appears broken because you are not finished wiring the block diagram.
Coercion Dots
Coercion dots appear on block diagram nodes to alert you that you wired two different numeric data types together. The dot means that LabVIEW converted the value passed into the node to a different representation. For example, the Add function expects two double-precision floating-point inputs. If you change one of those inputs to an integer, a coercion dot appears on the Add function.
The block diagram places a coercion dot on the border of a terminal where the conversion takes place to indicate that automatic numeric conversion occurred. Because VIs and functions can have many terminals, a coercion dot can appear inside an icon if you wire through one terminal to another terminal.
5-15
Chapter 5
Coercion dots also appear on the terminal when you wire any data type to a variant terminal, except when you wire two variants together. Refer to the Handling Variant Data section of this chapter for more information about the variant data type. Coercion dots can cause a VI to use more memory and increase its run time. Try to keep data types consistent in your VIs.
Polymorphic VIs
Polymorphic VIs accept different data types for a single input or output terminal. A polymorphic VI is a collection of subVIs with the same connector pane patterns. Each subVI is an instance of the polymorphic VI. For example, the Read Key VI is polymorphic. Its default value terminal accepts Boolean; double-precision, floating-point numeric; 32-bit signed integer numeric; path; string; or 32-bit unsigned integer numeric data. For most polymorphic VIs, the data types you wire to the inputs of the polymorphic VI determine the instance to use. If the polymorphic VI does not contain a subVI compatible with that data type, a broken wire appears. If the data types you wire to the polymorphic VI inputs do not determine the instance to use, you must select the instance manually. If you manually select an instance of a polymorphic VI, the VI no longer behaves as a polymorphic VI because it accepts and returns only the data types of the instance you select. To select the instance manually, right-click the polymorphic VI, select Select Type from the shortcut menu, and select the instance to use. You also can use the Operating tool to click the polymorphic VI selector, shown at left, and select an instance from the shortcut menu. Right-click the polymorphic VI on the block diagram and select Visible Items Polymorphic VI Selector from the shortcut menu to display the selector. To change the polymorphic VI to accept all the handled data types again, right-click the polymorphic VI and select Select TypeAutomatic from the shortcut menu or use the Operating tool to click the polymorphic VI selector and select Automatic from the shortcut menu.
5-16
ni.com
Chapter 5
You can build and edit polymorphic VIs only in the LabVIEW Professional Development System. For example, if you want to perform the same mathematical operation on a single-precision floating-point numeric, an array of numerics, or a waveform, you could create three separate VIsCompute Number, Compute Array, and Compute Waveform. When you need to perform the operation, you place one of these VIs on the block diagram, depending on the data type you use as an input. Instead of manually placing a version of the VI on the block diagram, you can create and use a single polymorphic VI. The polymorphic Compute VI contains three instances of the VI, as shown in Figure 5-3.
2
1 2 Compute Compute Number
3
3 4
4
Compute Array Compute Waveform
The Compute VI statically links the correct instance of the VI based on the data type you wire to the Compute subVI on the block diagram, as shown in Figure 5-4.
5-17
Chapter 5
2
1 2 Compute Compute Number 3 4
4
Compute Array Compute Waveform
Polymorphic VIs differ from most VIs in that they do not have a block diagram or a front panel. Consider the following issues when you build polymorphic VIs: All VIs you include in the polymorphic VI must have the same connector pane pattern, because the connector pane of the polymorphic VI matches the connector pane of the VIs you use to create the polymorphic VI. The inputs and outputs on the connector pane of each instance of the VI must correspond to the inputs and outputs on the connector pane of the polymorphic VI. The VIs you use to build polymorphic VIs do not have to consist of the same subVIs and functions. Each of the front panels of the VIs do not have to have the same number of objects. However, each front panel must have at least the same number of controls and indicators that make up the connector pane of the polymorphic VI. You can create an icon for a polymorphic VI. You cannot use polymorphic VIs in other polymorphic VIs.
When you generate complete documentation for a VI that includes a polymorphic subVI, the polymorphic VI and its instances appear in the list of subVIs section of the documentation.
5-18
ni.com
Chapter 5
Polymorphic Functions
Functions are polymorphic to varying degreesnone, some, or all of their inputs can be polymorphic. Some function inputs accept numerics or Boolean values. Some accept numerics or strings. Some accept not only scalar numerics, but also arrays of numerics, clusters of numerics, arrays of clusters of numerics, and so on. Some accept only one-dimensional arrays, although the array elements can be of any type. Some functions accept all types of data, including complex numerics. Refer to Appendix B, Polymorphic Functions, for more information about polymorphic functions.
Express VIs
Use the Express VIs for common measurement tasks. Express VIs are function nodes that require minimal wiring because you configure them with dialog boxes. The inputs and outputs for the Express VI depend on how you configure the VI. Express VIs appear on the block diagram as expandable nodes with icons surrounded by a blue field. Refer to the Displaying SubVIs and Express VIs as Icons or Expandable Nodes section of Chapter 7, Creating VIs and SubVIs, for more information about expandable nodes. Refer to the Getting Started with LabVIEW manual for more information about Express VIs.
5-19
Chapter 5
5-20
ni.com
Chapter 5
Data in Dynamic Data Type Single numeric value Single channel Multiple channels Single numeric value Single channel Multiple channels Single numeric value Single channel Multiple channels
Indicator Graph
Result Plots the single value, includes time stamp and attributes Plots the whole waveform, includes time stamp and attributes Plots all the data, includes time stamps and attributes
Numeric Indicator
Displays the single value Displays the last value of the channels data Displays the last value of the first channels data
Boolean Indicator
Displays a TRUE value if numeric value is greater than or equal to .5 Displays a TRUE value if the last value of channels data is greater than or equal to .5 Displays a TRUE value if the last value of the first channels data is greater than or equal to .5
5-21
Chapter 5
When you wire a dynamic data type to an array indicator, LabVIEW automatically places the Convert from Dynamic Data Express VI on the block diagram. 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.
5-22
ni.com
Chapter 5
strings is useful when you use TCP/IP to transmit data because the protocol understands only strings. However, using flattened data has limitations because LabVIEW cannot coerce flattened data when the original data type does not match the data type to which you want to convert. Also, attempting to unflatten a flattened integer as an extended-precision floating-point number fails. Refer to the Flattened Data section of the LabVIEW Data Storage Application Note for more information about flattening and unflattening data. Another advantage of using the variant data type is the ability to store attributes of the data. An attribute is information about the data that the variant data type stores. For example, if you want to know the time when a piece of data was created, you can store the data as variant data and add an attribute called Time to store the time string. The attribute data can be of any type. Use variant attributes when you want to sort the data by a particular attribute, identify the device or application that generated the data, or filter the data for only those variants with a particular attribute.
5-23
Chapter 5
Figure 5-5 shows wiring objects with compatible units. In this figure, LabVIEW automatically scales the distance indicator to display kilometers instead of meters because kilometers is the unit for the indicator.
An error occurs in Figure 5-6 because distance has a unit type of seconds. To correct the error, change seconds to a unit of distance, such as kilometers, as shown in Figure 5-5.
Figure 5-6. Wiring Objects with Incompatible Units Results in Broken Wires
Some VIs and functions are ambiguous with respect to units. You cannot use these VIs and functions with other terminals that have units. For example, the Increment function is ambiguous with respect to units. If you
5-24
ni.com
Chapter 5
use distance units, the Increment function cannot tell whether to add one meter, one kilometer, or one foot. Because of this ambiguity, you cannot use the Increment function and other functions that increment or decrement values with data that have associated units. To avoid ambiguity in this example, use a numeric constant with the proper unit and the Add function to create your own increment unit function, as shown in Figure 5-7.
5-25
Chapter 5
LabVIEW is a multitasking and multithreaded system, running multiple execution threads and multiple VIs simultaneously. Refer to the Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability Application Note for more information about performing tasks simultaneously in LabVIEW.
5-26
ni.com
Chapter 5
You also can create an artificial data dependency, in which the receiving node does not actually use the data received. Instead, the receiving node uses the arrival of data to trigger its execution. Refer to the Timing Template (data dep) VI in the examples\general\structs.llb for an example of using artificial data dependency.
The following block diagram establishes a dependency by wiring an output of the Read File function to the Close File function. The Close File function does not run until it receives the output of the Read File function.
5-27
Chapter 5
VIs and functions that generate data automatically allocate the memory for that data. When the VI or function no longer uses the data, LabVIEW deallocates the associated memory. When you add new data to an array or a string, LabVIEW allocates enough memory to manage the new data. Because LabVIEW automatically handles memory management, you have less control over when memory is allocated or deallocated. If your VI works with large sets of data, you need to understand when memory allocation takes place. Understanding the principles involved can help you write VIs with significantly smaller memory requirements. Minimizing memory usage can help you increase the speed at which VIs run. Refer to the LabVIEW Performance and Memory Management Application Note for more information about memory allocation. Refer to the Memory and Speed Optimization section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about optimizing memory usage as you develop.
5-28
ni.com
Chapter 5
Avoid wiring under a structure border or between overlapped objects, because LabVIEW might hide some segments of the resulting wire. Avoid placing objects on top of wires. Wires connect only those objects you click. Placing a terminal or icon on top of a wire makes it appear as if a connection exists when it does not. Use free labels to document code on the block diagram. Increase the space between crowded or tightly grouped objects by pressing the <Ctrl> key and use the Positioning tool to click the block diagram workspace. While holding the key combination, drag out a region the size you want to insert.
(Mac OS) Press the <Option> key. (Sun) Press the <Meta> key. (Linux) Press the <Alt> key.
A rectangle marked by a dashed border defines where space will be inserted. Release the key combination to add the space. Refer to the Block Diagram Style section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about designing the block diagram.
5-29
To run a VI, you must wire all the subVIs, functions, and structures with the data types the terminals expect. Sometimes a VI produces data or runs in a way you do not expect. You can use LabVIEW to configure how a VI runs and to identify problems with block diagram organization or with the data passing through the block diagram.
For more information Refer to the LabVIEW Help for more information about running and debugging VIs.
Running VIs
Running a VI executes the operation for which you designed the VI. You can run a VI if the Run button on the toolbar appears as a solid white arrow, shown at left. The solid white arrow also indicates you can use the VI as a subVI if you create a connector pane for the VI. While the VI runs, the Run button changes to darkened arrow, shown at left, to indicate that the VI is running. You cannot edit a VI while the VI runs. A VI runs when you click the Run or Run Continuously buttons or the single-stepping buttons on the block diagram toolbar. Clicking the Run button runs the VI once. The VI stops when the VI completes its data flow. Clicking the Run Continuously button, shown at left, runs the VI continuously until you stop it manually. Clicking the single-stepping buttons runs the VI in incremental steps. Refer to the Single-Stepping section of this chapter for more information about using the single-stepping buttons to debug a VI.
Note
Avoid using the Abort Execution button to stop a VI. Either let the VI complete its data flow or design a method to stop the VI programmatically. By doing so, the VI is at a known state. For example, place a button on the front panel that stops the VI.
6-1
Chapter 6
Incorrectly configuring a VI to run at different priorities can cause unexpected execution. You do not need to configure most VIs to run at different priorities.
6-2
ni.com
Chapter 6
menu, and placing a checkmark in the Show warnings in error box by default checkbox. You can make this change with the Error list window open and see the change immediately. Warnings do not prevent you from running a VI. They are designed to help you avoid potential problems in VIs.
Debugging Techniques
If a VI is not broken, but you get unexpected data, you can use the following techniques to identify and correct problems with the VI or the block diagram data flow: Wire the error in and error out parameters at the bottom of most built-in VIs and functions. These parameters detect errors encountered in each node on the block diagram and indicate if and where an error occurred. You also can use these parameters in the VIs you build. Refer to the Error Handling section of this chapter for more information about using these parameters. To eliminate all VI warnings, select WindowsShow Error List and place a checkmark in the Show Warnings checkbox to see all warnings for the VI. Determine the causes and correct them in the VI. Triple-click the wire with the Operating tool to highlight its entire path and to ensure that the wires connect to the proper terminals.
6-3
Chapter 6
Use the Context Help window to check the default values for each function and subVI on the block diagram. VIs and functions pass default values if recommended or optional inputs are unwired. For example, a Boolean input might be set to TRUE if unwired. Use the Find dialog box to search for subVIs, text, and other objects to correct throughout the VI. Select BrowseShow VI Hierarchy to find unwired subVIs. Unlike unwired functions, unwired VIs do not always generate errors unless you configure an input to be required. If you mistakenly place an unwired subVI on the block diagram, it executes when the block diagram does. Consequently, the VI might perform extra actions. Use execution highlighting to watch the data move through the block diagram. Single-step through the VI to view each action of the VI on the block diagram. Use the Probe tool to observe intermediate data values and to check the error output of VIs and functions, especially those performing I/O. Use breakpoints to pause execution, so you can single-step or insert probes. Suspend the execution of a subVI to edit values of controls and indicators, to control the number of times it runs, or to go back to the beginning of the execution of the subVI Comment out a section of the block diagram to determine if the VI performs better without it. Determine if the data that one function or subVI passes is undefined. This often happens with numbers. For example, at one point in the VI an operation could have divided a number by zero, thus returning Inf (infinity), whereas subsequent functions or subVIs were expecting numbers. If the VI runs more slowly than expected, confirm that you turned off execution highlighting in subVIs. Also, close subVI front panels and block diagrams when you are not using them because open windows can affect execution speed. Check the representation of controls and indicators to see if you are receiving overflow because you converted a floating-point number to an integer or an integer to a smaller integer. For example, you might wire a 16-bit integer to a function that only accepts 8-bit integers. This causes the function to convert the 16-bit integer to an 8-bit representation, potentially causing a loss of data.
6-4
ni.com
Chapter 6
Determine if any For Loops inadvertently execute zero iterations and produce empty arrays. Verify you initialized shift registers properly unless you intend them to save data from one execution of the loop to another. Check the cluster element order at the source and destination points. LabVIEW detects data type and cluster size mismatches at edit time, but it does not detect mismatches of elements of the same type. Check the node execution order. Check that the VI does not contain hidden subVIs. You inadvertently might have hidden a subVI by placing one directly on top of another node or by decreasing the size of a structure without keeping the subVI in view. Check the inventory of subVIs the VI uses against the results of BrowseThis VIs SubVIs and BrowseUnopened SubVIs to determine if any extra subVIs exist. Also open the Hierarchy window to see the subVIs for a VI. To help avoid incorrect results caused by hidden VIs, specify that inputs to VIs are required.
Execution Highlighting
View an animation of the execution of the block diagram by clicking the Highlight Execution button, shown at left. Execution highlighting shows the movement of data on the block diagram from one node to another using bubbles that move along the wires. Use execution highlighting in conjunction with single-stepping to see how data move from node to node through a VI.
Note
Execution highlighting greatly reduces the speed at which the VI runs. If the error out cluster reports an error, the error value appears next to error out with a red border. If no error occurs, OK appears next to error out with a green border. Refer to the Error Clusters section of this chapter for more information about error clusters.
Single-Stepping
Single-step through a VI to view each action of the VI on the block diagram as the VI runs. The single-stepping buttons, shown at left, affect execution only in a VI or subVI in single-step mode. Enter single-step mode by clicking the Step Over or Step Into button on the block diagram toolbar. Move the cursor over the Step Over, Step Into, or Step Out button to view
6-5
Chapter 6
a tip strip that describes the next step if you click that button. You can single-step through subVIs or run them normally. If you single-step through a VI with execution highlighting on, an execution glyph, shown at left, appears on the icons of the subVIs that are currently running.
Probe Tool
Use the Probe tool, shown at left, to check intermediate values on a wire as a VI runs. Use the Probe tool if you have a complicated block diagram with a series of operations, any one of which might return incorrect data. Use the Probe tool with execution highlighting, single-stepping, and breakpoints to determine if and where data are incorrect. If data are available, the probe immediately updates during single-stepping or when you pause at a breakpoint. When execution pauses at a node because of single-stepping or a breakpoint, you also can probe the wire that just executed to see the value that flowed through that wire.
Types of Probes
You can check intermediate values on a wire when a VI runs by using the Generic probe, by using an indicator on the Controls palette to view the data, by using a supplied probe, by using a customized supplied probe, or by creating a new probe.
Generic
Use the generic probe to view the data that pass through a wire. Right-click a wire and select Custom ProbeGeneric from the shortcut menu to use the generic probe. The generic probe displays the data. You cannot configure the generic probe to respond to the data. LabVIEW displays the generic probe when you right-click a wire and select Probe, unless you already specified a custom or supplied probe for the data type. You can debug a custom probe similar to a VI. However, a probe cannot probe its own block diagram, nor the block diagram of any of its subVIs. When debugging probes, use the generic probe.
6-6
ni.com
Chapter 6
Supplied
Supplied probes are VIs that display comprehensive information about the data that pass through a wire. For example, the VI Refnum Probe returns information about the VI name, the VI path, and the hex value of the reference. You also can use a supplied probe to respond based on the data that flow through the wire. For example, use an Error probe on an error cluster to receive the status, code, source, and description of the error and specify if you want set a conditional breakpoint if an error or warning occurs. The supplied probes appear at the top of the Custom Probe shortcut menu. Right-click a wire and select Custom Probe from the shortcut menu to select a supplied probe. Only probes that match the data type of the wire you right-click appear on the shortcut menu. Refer to the Using Supplied Probes VI in the examples\general\ probes.llb for an example of using supplied probes.
Custom
Use the Custom Probe Wizard to create a probe based on an existing probe or to create a new probe. Right-click a wire and select Custom ProbeNew from the shortcut menu to display the Custom Probe Wizard. Create a probe when you want to have more control over how LabVIEW probes the data that flow through a wire. When you create a new probe, the data type of the probe matches the data type of the wire you right-clicked. If you want to edit the probe you created, you must open it from the directory where you saved it.
6-7
Chapter 6
After you select a probe from the Custom Probe shortcut menu, navigate to it using the Select a Control palette option, or create a new probe using the Custom Probe Wizard, that probe becomes the default probe for that data type, and LabVIEW loads that probe when you right-click a wire and select Probe from the shortcut menu. LabVIEW only loads probes that exactly match the data type of the wire you right-click. That is, a double precision floating-point numeric probe cannot probe an unsigned 32-bit integer wire even though LabVIEW can convert the data. If you want a custom probe to be the default probe for a particular data type, save the probe in the user.lib\_probes\default directory. Do not save probes in the vi.lib\_probes directory because LabVIEW overwrites those files when you upgrade or reinstall.
Note
Refer to the LabVIEW Help for information about caveats when using and creating custom probes.
Breakpoints
Use the Breakpoint tool, shown at left, to place a breakpoint on a VI, node, or wire on the block diagram and pause execution at that location. When you set a breakpoint on a wire, execution pauses after data pass through the wire. Place a breakpoint on the block diagram to pause execution after all nodes on the block diagram execute. When a VI pauses at a breakpoint, LabVIEW brings the block diagram to the front and uses a marquee to highlight the node or wire that contains the breakpoint. When you move the cursor over an existing breakpoint, the black area of the Breakpoint tool cursor appears white. When you reach a breakpoint during execution, the VI pauses and the Pause button appears red. You can take the following actions: Single-step through execution using the single-stepping buttons. Probe wires to check intermediate values. Change values of front panel controls. Click the Pause button to continue running to the next breakpoint or until the VI finishes running.
LabVIEW saves breakpoints with a VI, but they are active only when you run the VI. You can view all breakpoints by selecting Browse Breakpoints.
6-8
ni.com
Chapter 6
Suspending Execution
Suspend execution of a subVI to edit values of controls and indicators, to control the number of times the subVI runs before returning to the caller, or to go back to the beginning of the execution of the subVI. You can cause all calls to a subVI to start with execution suspended, or you can suspend a specific call to a subVI. To suspend all calls to a subVI, open the subVI and select Operate Suspend when Called. The subVI automatically suspends when another VI calls it. If you select this menu item when single-stepping, the subVI does not suspend immediately. The subVI suspends when it is called. To suspend a specific subVI call, right-click the subVI node on the block diagram and select SubVI Node Setup from the shortcut menu. Place a checkmark in the Suspend when called checkbox to suspend execution only at that instance of the subVI. The Hierarchy window, which you display by selecting BrowseShow VI Hierarchy, indicates whether a VI is paused or suspended. An arrow glyph indicates a VI that is running regularly or single-stepping. A pause glyph indicates a paused or suspended VI. A green pause glyph, or a hollow glyph in black and white, indicates a VI that pauses when called. A red pause glyph, or a solid glyph in black and white, indicates a VI that is currently paused. An exclamation point glyph indicates that the subVI is suspended. A VI can be suspended and paused at the same time.
6-9
Chapter 6
Place the section you want to disable inside a Case structure and use a Boolean constant to run both cases. Refer to the Case Structures section of Chapter 8, Loops and Structures, for more information about using Case structures. You also can create a copy of the VI and delete that section of the block diagram from the copy. Discard the version of the VI you decide not to use.
produce, such as dividing a number by zero. LabVIEW does not check for overflow or underflow conditions on integer values. Overflow and underflow for floating-point numbers is in accordance with IEEE 754, Standard for Binary Floating-Point Arithmetic. Floating-point operations propagate NaN and Inf reliably. When you explicitly or implicitly convert NaN or Inf to integers or Boolean values, the values become meaningless. For example, dividing 1 by zero produces Inf. Converting Inf to a 16-bit integer produces the value 32,767, which appears to be a normal value. Refer to the Numeric Conversion section of Appendix B, Polymorphic Functions, for more information about converting numeric values. Before you convert data to integer data types, use the Probe tool to check intermediate floating-point values for validity. Check for NaN by wiring the Comparison function Not A Number/Path/Refnum? to the value you suspect is invalid.
6-10
ni.com
Chapter 6
For Loops
For Loops produce default data if you wire 0 to the count terminal of the For Loop or if you wire an empty array to the For Loop as an input with auto-indexing enabled. The loop does not execute, and any output tunnel with auto-indexing disabled contains the default value for the tunnel data type. Use shift registers to transfer values through a loop regardless of whether the loop executes. Refer to the For Loop and While Loop Structures section of Chapter 8, Loops and Structures, for more information about For Loops, auto-indexing, and shift registers.
6-11
Chapter 6
6-12
ni.com
Chapter 6
You upgraded the operating system software, which changed the path to a file or the functionality of a VI or library. You might notice a problem in a VI or a system program.
Error Handling
By default, LabVIEW automatically handles errors by suspending execution. You can choose other error handling methods. For example, if an I/O VI on the block diagram times out, you might not want the entire application to stop. You also might want the VI to retry for a certain period of time. In LabVIEW, you can make these error handling decisions on the block diagram of the VI. VIs and functions return errors in one of two wayswith numeric error codes or with an error cluster. Typically, functions use numeric error codes, and VIs use an error cluster, usually with error inputs and outputs. Refer to the Error Clusters section of this chapter for more information about error clusters. Error handling in LabVIEW follows the dataflow model. Just as data flow through a VI, so can error information. Wire the error information from the beginning of the VI to the end. Include an error handler VI at the end of the VI to determine if the VI ran without errors. Use the error in and error out clusters in each VI you use or build to pass the error information through the VI. As the VI runs, LabVIEW tests for errors at each execution node. If LabVIEW does not find any errors, the node executes normally. If LabVIEW detects an error, the node passes the error to the next node without executing that part of the code. The next node does the same thing, and so on. At the end of the execution flow, LabVIEW reports the error.
Error Clusters
The error in and error out clusters include the following components of information: status is a Boolean value that reports TRUE if an error occurred. Most VIs, functions, and structures that accept Boolean data also recognize this parameter. For example, you can wire an error cluster to the Boolean inputs of the Stop, Quit LabVIEW, or Select functions. If an error occurs, the error cluster passes a TRUE value to the function.
6-13
Chapter 6
code is a 32-bit signed integer that identifies the error numerically. A non-zero error code coupled with a status of FALSE signals a warning rather than a fatal error. source is a string that identifies where the error occurred.
6-14
ni.com
After you learn how to build a front panel and block diagram, you can create your own VIs and subVIs, distribute VIs, and build stand-alone applications and shared libraries. Refer to the LabVIEW Development Guidelines manual for more information about planning your project, including information about common development pitfalls and tools you can use to develop your project.
For more information Refer to the LabVIEW Help for more information about creating and using subVIs, saving VIs, and building stand-alone applications and shared libraries.
7-1
Chapter 7
diagram easy to read, debug, understand, and maintain. You also can create subVIs for common or frequent operations that you can reuse. Test subVIs as you create them. You can create higher level test routines, but catching errors in a small module is easier than testing a hierarchy of several VIs. You might find that the initial design of the high-level block diagram is incomplete. Using subVIs to accomplish low-level tasks makes it easier to modify or reorganize your application. Refer to the SubVIs section of this chapter for more information about subVIs. Select HelpFind Examples for examples of block diagrams and subVIs.
VI Templates
The LabVIEW VI templates include the subVIs, functions, structures, and front panel objects you need to get started building common measurement applications. VI templates open as untitled VIs that you must save. Select FileNew to display the New dialog box, which includes the LabVIEW VI templates. You also can display the New dialog box by selecting New from the New pull-down menu of the LabVIEW dialog box. If you use a VI template as a subVI, LabVIEW prompts you to save the template as a VI before you closing the VI.
7-2
ni.com
Chapter 7
Creating VI Templates
Create custom VI templates to avoid placing the same components on the front panel or block diagram each time you want to perform a similar operation. Create a custom VI template by building a VI and saving it as a template.
7-3
Chapter 7
more information about installing the NI-DAQ driver software and DAQ hardware and building VIs to acquire data. After you acquire data, you can use the built-in Analyze, Report Generation, and Mathematics VIs and functions to analyze, generate reports, and perform mathematical operations on that data. Refer to the LabVIEW Analysis Concepts manual for more information about analysis and mathematical concepts in LabVIEW.
control ActiveX-enabled applications. Refer to Chapter 19, Windows Connectivity, for more information about using ActiveX technology.
SubVIs
After you build a VI and create its icon and connector pane, you can use it in another VI. A VI called from the block diagram of another VI is called a subVI. A subVI corresponds to a subroutine in text-based programming languages. A subVI node corresponds to a subroutine call in text-based programming languages. The node is not the subVI itself, just as a subroutine call statement in a program is not the subroutine itself. A block
7-4
ni.com
Chapter 7
diagram that contains several identical subVI nodes calls the same subVI several times. The subVI controls and indicators receive data from and return data to the block diagram of the calling VI. Click the Select a VI icon on the Functions palette, navigate to and double-click a VI, and place the VI on a block diagram to create a subVI call to that VI.
Note
Before you can use a VI as a subVI, you must set up a connector pane. Refer to the Setting up the Connector Pane section of this chapter for more information about setting up a connector pane. You can edit a subVI by using the Operating or Positioning tool to double-click the subVI on the block diagram. When you save the subVI, the changes affect all calls to the subVI, not just the current instance. When LabVIEW calls a subVI, ordinarily the subVI runs without displaying its front panel. If you want a single instance of the subVI to display its front panel when called, right-click the subVI icon and select SubVI Node Setup from the shortcut menu. If you want every instance of the subVI to display its front panel when called, select FileVI Properties, select Window Appearance from the Category pull-down menu, and click the Customize button.
7-5
Chapter 7
You can create a subVI that performs that operation and call the subVI twice, as shown in Figure 7-2.
You also can reuse the subVI in other VIs. Refer to Chapter 8, Loops and Structures, for more information about using loops to combine common operations.
7-6
ni.com
Chapter 7
Define connections by assigning a front panel control or indicator to each of the connector pane terminals. To define a connector pane, right-click the icon in the upper right corner of the front panel window and select Show Connector from the shortcut menu to display the connector pane. The connector pane replaces the icon. Each rectangle on the connector pane represents a terminal. Use the rectangles to assign inputs and outputs. The number of terminals LabVIEW displays on the connector pane depends on the number of controls and indicators on the front panel. The connector pane has, at most, 28 terminals. If your front panel contains more than 28 controls and indicators that you want to use programmatically, group some of them into a cluster and assign the cluster to a terminal on the connector pane. Refer to the Clusters section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about grouping data using clusters.
Note
Assigning more than 16 terminals to a VI can reduce readability and usability. Select a different terminal pattern for a VI by right-clicking the connector pane and selecting Patterns from the shortcut menu. Select a connector pane pattern with extra terminals. You can leave the extra terminals unconnected until you need them. This flexibility enables you to make changes with minimal effect on the hierarchy of the VIs. If you create a group of subVIs that you use together often, give the subVIs a consistent connector pane with common inputs in the same location to help you remember where to locate each input. If you create a subVI that produces an output another subVI uses as the input, align the input and output connections to simplify the wiring patterns. Place the error in clusters on the lower left corner of the front panel and the error out clusters on the lower right corner. Figure 7-3 shows examples of improperly and properly aligned error clusters.
1 2
Improper
Proper
7-7
Chapter 7
Refer to the Connector Panes section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about style to use when setting up a connector pane.
Creating an Icon
Every VI displays an icon, shown at left, in the upper right corner of the front panel and block diagram windows. An icon is a graphical representation of a VI. It can contain text, images, or a combination of both. If you use a VI as a subVI, the icon identifies the subVI on the block diagram of the VI. The default icon contains a number that indicates how many new VIs you have opened since launching LabVIEW. Create custom icons to replace the default icon by right-clicking the icon in the upper right corner of the front
7-8
ni.com
Chapter 7
panel or block diagram and selecting Edit Icon from the shortcut menu or by double-clicking the icon in the upper right corner of the front panel. You also can drag a graphic from anywhere in your file system and drop it in the upper right corner of the front panel or block diagram. LabVIEW converts the graphic to a 32 32 pixel icon. Depending on the type of monitor you use, you can design a separate icon for monochrome, 16-color, and 256-color mode. LabVIEW uses the monochrome icon for printing unless you have a color printer. Refer to the Icons section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about designing an icon.
If you display a subVI or Express VI as an expandable node, you cannot display the terminals for that node and you cannot enable database access for that node. When you resize an expandable subVI or Express VI, the input and output terminals of the subVI or Express VI appear below the icon. Optional terminals appear with gray backgrounds. Recommended or required input or output terminals you do not display appear as input or output arrows in the colored field that surrounds the subVI or Express VI icon. If you wire to an optional terminal when the subVI or Express VI is expanded, then resize the subVI or Express VI so the optional terminal no longer appears in the expanded field, the optional terminal appears as an input or output arrow in the colored field. However, if you unwire the optional terminal, the input or output arrow does not appear. By default, inputs appear above outputs when you expand the subVI or Express VI. Right-click a terminal in the expandable field and select Select Input/Output from the shortcut menu to select an input or output to
7-9
Chapter 7
display. A line divides inputs from outputs in the shortcut menu. Labels for expandable subVIs and Express VIs appear in the colored field that surrounds the icon. To resize the expandable node so it accommodates the name of each terminal on a single line in the expandable field, right-click the subVI or Express VI and select Size to Text from the shortcut menu. The following expandable subVI displays four of 10 input and output terminals.
Refer to the Getting Started with LabVIEW manual for more information about Express VIs.
Designing SubVIs
If users do not need to view the front panel of a subVI, you can spend less time on its appearance, including colors and fonts. However, front panel organization is still important because you might need to view the front panel while you debug the VI.
7-10
ni.com
Chapter 7
Place the controls and indicators as they appear in the connector pane. Place the controls on the left of the front panel and the indicators on the right. Place the error in clusters on the lower left of the front panel and the error out clusters on the lower right. Refer to the Setting up the Connector Pane section of this chapter for more information about setting up a connector pane. If a control has a default value, put the default value in parentheses as part of the control name. Also include measurement units, if applicable, in the control name. For example, if a control sets the high limit temperature and has a default value of 75 F, name the control high limit temperature (75 degF). If you will use the subVI on multiple platforms, avoid using special characters in control names. For example, use degF instead of F. Name Boolean controls so users can determine what the control does in the TRUE state. Use names like Cancel, Reset, and Initialize that describe the action taken.
7-11
Chapter 7
Saving VIs
You can save VIs as individual files or you can group several VIs together and save them in a VI library. VI library files end with the extension .llb. National Instruments recommends that you save VIs as individual files, organized in directories, especially if multiple developers are working on the same project. Refer to the Organizing VIs in Directories section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about organizing VIs in directories.
filenames, but has no limit on characters for VI filenames in a library. You can transfer a VI library to other platforms more easily than you can transfer multiple individual VIs. You also can ensure that the user receives all the files needed. You can slightly reduce the file size of your project because VI libraries are compressed to reduce disk space requirements. You can mark VIs in a library as top-level so when you open the library, LabVIEW automatically opens all the top-level VIs in that library.
Note LabVIEW stores many of its built-in VIs and examples in VI libraries to ensure consistent storage locations on all platforms.
7-12
ni.com
Chapter 7
If you use VI libraries, consider dividing your application into multiple VI libraries. Put the high-level VIs in one VI library and set up other libraries to contain VIs separated by function. Saving changes to a VI in a library takes longer than saving changes to an individual VI, because the operating system must write the changes to a larger file. Saving changes to a large library also can increase memory requirements and decrease performance. Try to limit the size of each library to approximately 1 MB.
Naming VIs
When you save VIs, use descriptive names. Descriptive names, such as Temperature Monitor.vi and Serial Write & Read.vi, make it easy to identify a VI and know how you use it. If you use ambiguous names, such as VI#1.vi, you might find it difficult to identify VIs, especially if you have saved several VIs. Consider whether your users will run the VIs on another platform. Avoid using characters that some operating systems reserve for special purposes, such as \ : / ? * < > and #. Keep VI names less than 31 characters if your users might run them on Mac OS 9.x or earlier.
7-13
Chapter 7
Distributing VIs
If you want to distribute VIs to other computers or to other users, consider if you want to include block diagram source code users can edit or if you want to hide or remove the block diagram. If you want to distribute VIs that include block diagram source code to other LabVIEW users, you can assign password protection to the block diagrams. The block diagram is still available, but users must enter a password to view or edit the block diagram. If you want to distribute VIs to developers of other programming languages, you can build a stand-alone application or shared library. A stand-alone application or shared library is appropriate when you do not expect your users to edit the VIs. Users can run your application or use the shared library, but they cannot edit or view the block diagrams.
Note You can create stand-alone applications or shared libraries only in the LabVIEW Professional Development Systems or using the Application Builder.
Another option for distributing VIs is to remove the block diagram source code so other users cannot edit the VI. Select FileSave With Options to save VIs without the block diagrams to reduce the file size and prevent users from changing the source code. If you save a VI without the block diagram, users cannot move the VI to another platform or upgrade the VI to a future version of LabVIEW.
7-14
ni.com
Chapter 7
Caution If you save VIs without block diagrams, do not overwrite the original versions of the VIs. Save the VIs in different directories or use different names.
Refer to the Porting and Localizing LabVIEW VIs Application Note for more information about porting VIs among platforms and localizing VIs.
Refer to the LabVIEW Application Builder User Guide for more information about installing the Application Builder.
7-15
Part II
Building and Editing VIs
This part describes LabVIEW features, VIs, and functions you can use to make your applications operate in specific ways. The chapters in this section describe the usefulness of each LabVIEW feature and outline each class of VIs and functions. Part II, Building and Editing VIs, contains the following chapters: Chapter 8, Loops and Structures, describes how to use loops and structures on the block diagram to repeat blocks of code and to execute code conditionally or in a specific order. Chapter 9, Event-Driven Programming, describes how to dynamically and statically register events and how to create and name your own events. Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, describes how to use strings, arrays, and clusters to group data. Chapter 11, Local and Global Variables, describes how to use local and global variables pass information between locations in your application that you cannot connect with a wire. Chapter 12, Graphs and Charts, describes how to use graphs and charts to display plots of data in a graphical form. Chapter 13, Graphics and Sound VIs, describes how to display or modify graphics and sound in VIs. Chapter 14, File I/O, describes how to perform file I/O operations. Chapter 15, Documenting and Printing VIs, describes how to document and print VIs. Chapter 16, Customizing VIs, describes how to configure VIs and subVIs to work according to your application needs.
II-1
Part II
Chapter 17, Programmatically Controlling VIs, describes how to communicate with VIs and other instances of LabVIEW so you can programmatically control VIs and LabVIEW. Chapter 18, Networking in LabVIEW, describes how to use VIs to communicate, or network, with other processes, including those that run on other applications or on remote computers. Chapter 19, Windows Connectivity, describes how to provide a public set of objects, commands, and functions that other Windows applications can access. Chapter 20, Calling Code from Text-Based Programming Languages, describes how to call code from text-based programming languages and use DLLs. Chapter 21, Formulas and Equations, describes how to use equations in VIs.
II-2
ni.com
Structures are graphical representations of the loops and case statements of text-based programming languages. Use structures on the block diagram to repeat blocks of code and to execute code conditionally or in a specific order. Like other nodes, structures have terminals that connect them to other block diagram nodes, execute automatically when input data are available, and supply data to output wires when execution completes. Each structure has a distinctive, resizable border to enclose the section of the block diagram that executes according to the rules of the structure. The section of the block diagram inside the structure border is called a subdiagram. The terminals that feed data into and out of structures are called tunnels. A tunnel is a connection point on a structure border.
For more information Refer to the LabVIEW Help for more information about using structures.
Use the following structures located on the Structures palette to control how a block diagram executes processes: For LoopExecutes a subdiagram a set number of times. While LoopExecutes a subdiagram until a condition is met. Case structureContains multiple subdiagrams, only one of which executes depending on the input value passed to the structure. Sequence structureContains one or more subdiagrams, which execute in sequential order. Formula NodePerforms mathematical operations based on numeric input. Refer to the Formula Nodes section of Chapter 21, Formulas and Equations, for information about using Formula Nodes. Event structureContains one or more subdiagrams that execute depending on how the user interacts with the VI.
8-1
Chapter 8
For Loops
A For Loop, shown at left, executes a subdiagram a set number of times. The value in the count terminal (an input terminal), shown at left, indicates how many times to repeat the subdiagram. Set the count explicitly by wiring a value from outside the loop to the left or top side of the count terminal, or set the count implicitly with auto-indexing. Refer to the Auto-Indexing to Set the For Loop Count section of this chapter for more information about setting the count implicitly. The iteration terminal (an output terminal), shown at left, contains the number of completed iterations. The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0. Both the count and iteration terminals are 32-bit signed integers. If you wire a floating-point number to the count terminal, LabVIEW rounds it and coerces it to within range. If you wire 0 or a negative number to the count terminal, the loop does not execute and the outputs contain the default data for that data type. Add shift registers to the For Loop to pass data from the current iteration to the next iteration. Refer to the Shift Registers and the Feedback Node in Loops section of this chapter for more information about adding shift registers to a loop.
While Loops
Similar to a Do Loop or a Repeat-Until Loop in text-based programming languages, a While Loop, shown at left, executes a subdiagram until a condition is met. The While Loop executes the subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value. The default behavior and appearance of the conditional terminal is Stop if True, shown at left. When a conditional terminal is Stop if True, the While Loop executes its subdiagram until the conditional terminal receives a TRUE value. You can change the behavior and appearance of the conditional terminal by right-clicking the terminal or the border of the While Loop and selecting Continue if True, shown at left, from the shortcut menu. When a conditional terminal is Continue if True, the While Loop executes its
8-2
ni.com
Chapter 8
subdiagram until the conditional terminal receives a FALSE value. You also can use the Operating tool to click the conditional terminal to change the condition. You also can perform basic error handling using the conditional terminal of a While Loop. When you wire an error cluster to the conditional terminal, only the TRUE or FALSE value of the status parameter of the error cluster passes to the terminal. Also, the Stop if True and Continue if True shortcut menu items change to Stop if Error and Continue while Error. Refer to the Error Checking and Error Handling section of Chapter 6, Running and Debugging VIs, for more information about error clusters and error handling. The iteration terminal (an output terminal), shown at left, contains the number of completed iterations. The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0. Add shift registers to the While Loop to pass data from the current iteration to the next iteration. Refer to the Shift Registers and the Feedback Node in Loops section of this chapter for more information about adding shift registers to a loop.
Changing the value of the control does not stop the infinite loop because the value is only read once, before the loop starts. To stop an infinite loop, you must abort the VI by clicking the Abort button on the toolbar.
8-3
Chapter 8
Auto-Indexing Loops
If you wire an array to a For Loop or While Loop input tunnel, you can read and process every element in that array by enabling auto-indexing. Refer to Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about arrays. When you wire an array to an input tunnel on the loop border and enable auto-indexing on the input tunnel, elements of that array enter the loop one at a time, starting with the first element. When auto-indexing is disabled, the entire array is passed into the loop. When you auto-index an array output tunnel, the output array receives a new element from every iteration of the loop. Therefore, auto-indexed output arrays are always equal in size to the number of iterations. Right-click the tunnel at the loop border and select Enable Indexing or Disable Indexing from the shortcut menu to enable or disable auto-indexing. Auto-indexing for While Loops is disabled by default. The loop indexes scalar elements from 1D arrays, 1D arrays from 2D arrays, and so on. The opposite occurs at output tunnels. Scalar elements accumulate sequentially into 1D arrays, 1D arrays accumulate into 2D arrays, and so on.
8-4
ni.com
Chapter 8
When you auto-index an array output tunnel, the output array receives a new element from every iteration of the loop. Therefore, auto-indexed output arrays are always equal in size to the number of iterations. For example, if the loop executes 10 times, the output array has 10 elements. If you disable auto-indexing on an output tunnel, only the element from the last iteration of the loop passes to the next node on the block diagram. A bracketed glyph appears on the loop border to indicate that auto-indexing is enabled. The thickness of the wire between the output tunnel and the next node also indicates the loop is using auto-indexing. The wire is thicker when you use auto-indexing because the wire contains an array, instead of a scalar.
Because you cannot determine the size of the output array in advance, enabling auto-indexing for the output of a For Loop is more efficient than with a While Loop. Iterating too many times can cause your system to run out of memory.
8-5
Chapter 8
Shift Registers
Use shift registers when you want to pass values from previous iterations through the loop. A shift register appears as a pair of terminals, shown at left, directly opposite each other on the vertical sides of the loop border. The right terminal contains an up arrow and stores data on the completion of an iteration. LabVIEW transfers the data connected to the right side of the register to the next iteration. Create a shift register by right-clicking the left or right border of a loop and selecting Add Shift Register from the shortcut menu. A shift register transfers any data type and automatically changes to the data type of the first object wired to the shift register. The data you wire to the terminals of each shift register must be the same type. Initialize a shift register by wiring a control or constant to the shift register terminal on the left side of the loop. Initializing a shift register resets the value the shift register passes the first time the loop executes when the VI runs. If you do not initialize the register, the loop uses the value written to the register when the loop last executed or the default value for the data type if the loop has never executed. Use a loop with an uninitialized shift register to run a VI repeatedly so that each time the VI runs, the initial output of the shift register is the last value from the previous execution. Use an uninitialized shift register to preserve state information between subsequent executions of a VI. After the loop executes, the last value stored in the shift register is output from the right terminal. You can add more than one shift register to a loop. If you have multiple operations that use previous iteration values within your loop, use multiple shift registers to store the data values from those different processes in the structure.
8-6
ni.com
Chapter 8
If you add another element to the left terminal, values from the last two iterations carry over to the next iteration, with the most recent iteration value stored in the top shift register. The bottom terminal stores the data passed to it from the previous iteration.
8-7
Chapter 8
If you replace an output shift register terminal with a tunnel on a For Loop, the wire to any node outside the loop breaks because the For Loop enables indexing by default. Right-click the tunnel and select Disable Indexing at Source from the shortcut menu to disable indexing and automatically correct the broken wire. If you want indexing enabled, delete the broken wire and the indicator terminal, right-click the tunnel, and select Create Indicator. Refer to the Auto-Indexing Loops section of this chapter for more information about indexing in loops.
Feedback Node
The Feedback Node, shown at left, appears automatically only in a For Loop or While Loop when you wire the output of a subVI, function, or group of subVIs and functions to the input of that same VI, function, or group. Like a shift register, the Feedback Node stores data when the loop completes an iteration, sends that value to the next iteration of the loop, and transfers any data type. Use the Feedback Node to avoid unnecessarily long wires in loops. The Feedback Node arrow indicates in which direction the data flows along the wire.
8-8
ni.com
Chapter 8
You also can select the Feedback Node and place it only inside a For Loop or While Loop. If you place the Feedback Node on the wire before you branch the wire that connects the data to the tunnel, the Feedback Node passes each value to the tunnel. If you place the Feedback Node on the wire after you branch the wire that connects data to the tunnel, the Feedback Node passes each value back to the input of the VI or function and then passes the last value to the tunnel. For example, the For Loop in Figure 8-4 iterates 10 times. The Feedback Node passes the value from the previous iteration of the loop to the tunnel before it passes the value to the input of the Add function. The value in the tunnel is always the value from the previous iteration. On the last iteration of the loop, the Feedback Node holds the last value, which in this case is 45, but does not pass that value to the tunnel or to the numeric indicator. When the VI finishes running, the value in the numeric indicator is 36, which is the value from the previous, not the last, iteration of the loop.
Figure 8-4. Passing the Next to Last Value Out of the For Loop
The For Loop in Figure 8-5 also iterates 10 times. However, the Feedback Node passes the value from the previous iteration only to the input of the Add function each time the loop iterates. On the last iteration of the loop, the Feedback Node passes the value from the previous iteration (36) to the input of the Add function. The Add function adds the value the iteration terminal generates (9) to the value the Feedback Node passes (36) and sends the result to the tunnel. When the VI finishes running, the value in the numeric indicator is 45.
8-9
Chapter 8
Figure 8-5. Passing the Last Value Out of the For Loop
Controlling Timing
You might want to control the speed at which a process executes, such as the speed at which data are plotted to a chart. You can use a wait function in the loop to wait an amount of time in milliseconds before the loop re-executes. Refer to the Memory and Speed Optimization section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about using a wait function in a loop to optimize memory usage.
8-10
ni.com
Chapter 8
Case Structures
A Case structure, shown at left, has two or more subdiagrams, or cases. Only one subdiagram is visible at a time, and the structure executes only one case at a time. An input value determines which subdiagram executes. The Case structure is similar to case statements or if...then...else statements in text-based programming languages. The case selector label at the top of the Case structure, shown at left, contains the name of the selector value that corresponds to the case in the center and decrement and increment arrows on each side. Click the decrement and increment arrows to scroll through the available cases. You also can click the down arrow next to the case name and select a case from the pull-down menu. Wire an input value, or selector, to the selector terminal, shown at left, to determine which case executes. You must wire an integer, Boolean value, string, or enumerated type value to the selector terminal. You can position the selector terminal anywhere on the left border of the Case structure. If the data type of the selector terminal is Boolean, the structure has a TRUE case and a FALSE case. If the selector terminal is an integer, string, or enumerated type value, the structure can have any number of cases. Specify a default case for the Case structure to handle out-of-range values. Otherwise, you must explicitly list every possible input value. For example, if the selector is an integer and you specify cases for 1, 2, and 3, you must specify a default case to execute if the input value is 4 or any other valid integer value.
8-11
Chapter 8
numbers less than or equal to 100, and 100.. represents all numbers greater than or equal to 100. You also can combine lists and ranges, for example ..5, 6, 7..10, 12, 13, 14. When you enter values that contain overlapping ranges in the same case selector label, the Case structure redisplays the label in a more compact form. The previous example redisplays as ..10, 12..14. For string ranges, a range of a..c includes all of a and b, but not c. A range of a..c,c includes the ending value of c. When you enter string and enumerated values in a case selector label, the values display in quotation marks, for example red, green, and blue. However, you do not need to type the quotation marks when you enter the values unless the string or enumerated value contains a comma or range symbol ("," or ".."). In a string value, use special backslash codes for non-alphanumeric characters, such as \r for a carriage return, \n for a line feed, and \t for a tab. Refer to the LabVIEW Help for a list of these backslash codes. If you change the data type of the wire connected to the selector terminal of a Case structure, the Case structure automatically converts the case selector values to the new data type when possible. If you convert a numeric value, for example 19, to a string, the string value is 19. If you convert a string to a numeric value, LabVIEW converts only those string values that represent a number. The other values remain strings. If you convert a number to a Boolean value, LabVIEW converts 0 to FALSE and 1 to TRUE, and all other numeric values become strings. If you enter a selector value that is not the same type as the object wired to the selector terminal, the value appears red to indicate that you must delete or edit the value before the structure can execute, and the VI will not run. Also, because of the possible round-off error inherent in floating-point arithmetic, you cannot use floating-point numerics as case selector values. If you wire a floating-point value to the case, LabVIEW rounds the value to the nearest even integer. If you type a floating-point value in the case selector label, the value appears red to indicate that you must delete or edit the value before the structure can execute.
Chapter 8
a different data source for the same output tunnel in each case, but the data types must be compatible for each case. You also can right-click the output tunnel and select Use Default If Unwired from the shortcut menu to use the default value for the tunnel data type for all unwired tunnels.
Sequence Structures
A sequence structure contains one or more subdiagrams, or frames, that execute in sequential order. Sequence structures are not used commonly in LabVIEW. Refer the Using Sequence Structures and the Avoiding Overusing Sequence Structures sections of this chapter for more information on when to use sequence structures. There are two types of sequence structures, the Flat Sequence structure and the Stacked Sequence structure.
8-13
Chapter 8
Use the sequence selector identifier to navigate through the available frames and rearrange frames. The frame label in a Stacked Sequence structure is similar to the case selector label of the Case structure. The frame label contains the frame number in the center and decrement and increment arrows on each side. Click the decrement and increment arrows to scroll through the available frames. You also can click the down arrow next to the frame number and select a frame from the pull-down menu. Right-click the border of a frame, select Make This Frame, and select a frame number from the shortcut menu to rearrange the order of a Stacked Sequence structure. Unlike the case selector label, you cannot enter values in the frame label. When you add, delete, or rearrange frames in a Stacked Sequence structure, LabVIEW automatically adjusts the numbers in the frame labels.
8-14
ni.com
Chapter 8
Figure 8-6. Updating an Indicator from Different Frames in a Stacked Sequence Structure
Because all frames of a Stacked Sequence structure execute before any data pass out of the structure, only one frame can assign a value to the Status indicator. Instead, use a Case structure and a While Loop, as shown in Figure 8-7.
8-15
Chapter 8
Each case in the Case structure is equivalent to a sequence structure frame. Each iteration of the While Loop executes the next case. The Status indicator displays the status of the VI for each case. The Status indicator is updated in the case before the one that calls the corresponding subVI because data pass out of the structure after each case executes. Unlike a sequence structure, a Case structure can pass data to end the While Loop during any case. For example, if an error occurs while running the first test, the Case structure can pass FALSE to the conditional terminal to end the loop. However, a sequence structure must execute all its frames even if an error occurs.
8-16
ni.com
Event-Driven Programming
LabVIEW is a dataflow programming environment where the flow of data determines the execution order of block diagram elements. Event-driven programming features extend the LabVIEW dataflow environment to allow the users direct interaction with the front panel and other asynchronous activity to further influence block diagram execution.
Note Event-driven programming features are available only in the LabVIEW Full and Professional Development Systems. You can run a VI built with these features in the LabVIEW Base Package, but you cannot reconfigure the event-handling components.
For more information Refer to the LabVIEW Help for more information about using events in your application.
9-1
Chapter 9
Event-Driven Programming
and on the order in which they occur. Some sections of the program might execute frequently because the events they handle occur frequently, and other sections of the program might not execute at all because the events never occur.
9-2
ni.com
Chapter 9
Event-Driven Programming
(Windows) You also can move the cursor over the selector label and press the <Ctrl> key while moving the mouse wheel. (UNIX) Press the
<Meta> key. The Timeout terminal at the top left corner of the Event structure, shown at left, specifies the number of milliseconds to wait for an event before timing out. The default is 1, which specifies to wait indefinitely for an event to occur. If you wire a value to the Timeout terminal, you must provide a Timeout case. The Event Data Node, shown at left, behaves similarly to the Unbundle By Name function. This node is attached to the inside left border of each event case. The node identifies the data LabVIEW provides when an event occurs. You can resize this node vertically to add more data items, and you can set each data item in the node to access any event data element. The node provides different data elements in each case of the Event structure depending on which event(s) you configure that case to handle. If you configure a single case to handle multiple events, the Event Data Node provides only the event data elements that are common to all the events configured for that case. The Event Filter Node, shown at left, is similar to the Event Data Node. This node is attached to the inside right border of filter event cases. The node identifies the subset of data available in the Event Data Node that the event case can modify. The node displays different data depending on which event(s) you configure that case to handle. By default, these items are inplace to the corresponding data items in the Event Data Node. If you do not wire a value to a data item of an Event Filter Node, that data item remains unchanged. Refer to the Notify and Filter Events section of this chapter for more information about filter events. The dynamic event terminals, shown at left, are available by right-clicking the Event structure and selecting Show Dynamic Event Terminals from the shortcut menu. These terminals are used only for dynamic event registration. Refer to the Dynamic Event Registration and Modifying Registration Dynamically sections of this chapter for more information about using these terminals.
Note Like a Case structure, the Event structure supports tunnels. However, by default you do not have to wire Event structure output tunnels in every case. All unwired tunnels use the default value for the tunnel data type. Right-click a tunnel and deselect Use Default If Unwired from the shortcut menu to revert to the default Case structure behavior where tunnels must be wired in all cases.
9-3
Chapter 9
Event-Driven Programming
Refer to the LabVIEW Help for information about the default values for data types.
9-4
ni.com
Chapter 9
Event-Driven Programming
National Instruments recommends you use filter events only when you want to take part in the handling of the user action, either by discarding the event or by modifying the event data. If you only want to know that the user performed a particular action, use notify events.
Note
Event structure cases that handle filter events have an Event Filter Node as described in the Event Structure Components section of this chapter. You can change the event data by wiring new values to these terminals. If you do not wire a data item, that item remains unchanged. You can completely discard an event by wiring a TRUE value to the Discard? terminal.
Note
A single case in the Event structure cannot handle both notify and filter events. A case can handle multiple notify events but can handle multiple filter events only if the event data items are identical for all events.
9-5
Chapter 9
Event-Driven Programming
Note In general, LabVIEW generates user interface events only as a result of direct user interaction with the active front panel. LabVIEW does not generate events, such as Value Change, when you use the VI Server, global variables, local variables, DataSocket, and so on. Refer to the Value (Signaling) property in the LabVIEW Help for information about generating a Value Change event programmatically. In many cases, you can use programmatically generated events instead of queues and notifiers.
The event data provided by a LabVIEW event always include a time stamp, an enumeration that indicates which event occurred, and a VI Server reference to the object that triggered the event. The time stamp is a millisecond counter you can use to compute the time elapsed between two events or to determine the order of occurrence. The reference to the object that generated the event is strictly typed to the VI Server class of that object. Events are grouped into classes according to what type of object generates the event, such as Application, VI, or Control. If a single case handles multiple events for objects of different VI Server classes, the reference type is the common parent class of all objects. For example, if you configure a single case in the Event structure to handle events for a digital numeric control and a color ramp control, the type of the control reference of the event source is Numeric because the digital numeric and color ramp controls are in the Numeric class. Refer to Chapter 17, Programmatically Controlling VIs, for more information about using VI Server classes.
Note
If you register for the same event on both the VI and Control class, LabVIEW generates the VI event first. LabVIEW generates Control events for container objects, such as clusters, before it generates events for the objects they contain. If the Event structure case for a VI event or for a Control event on a container object discards the event, LabVIEW does not generate further events. Each Event structure and Register For Events node on the block diagram owns a queue that LabVIEW uses to store events. When an event occurs, LabVIEW places a copy of the event into each queue registered for that event. An Event structure handles all events in its queue and the events in the queues of any Register For Events nodes that you wired to the dynamic event terminals of the Event structure. LabVIEW uses these queues to ensure that events are reliably delivered to each registered Event structure in the order the events occur. By default, LabVIEW locks the front panel that contains the object that generates an event until all Event structures finish handling the event. While the front panel is locked, LabVIEW does not process front panel activity but places those interactions in a buffer and handles them when the front panel is unlocked. Front panel locking does not affect certain actions,
9-6
ni.com
Chapter 9
Event-Driven Programming
such as moving the window, interacting with the scrollbars, and clicking the Abort button. You can disable front panel locking for notify events by removing the checkmark from the option in the Edit Events dialog box. Front panel locking must be enabled for filter events to ensure the internal state of LabVIEW is not altered before it has an opportunity to completely process the pending event. LabVIEW can generate events even when no Event structure is waiting to handle them. Because the Event structure handles only one event each time it executes, place the Event structure in a While Loop to ensure that an Event structure can handle all events that occur.
Caution
If no Event structure executes to handle an event and front panel locking is enabled, the user interface of the VI becomes unresponsive. If this occurs, click the Abort button to stop the VI. You can disable panel locking by right-clicking the Event structure and removing the checkmark from the Lock front panel until the event case for this event completes checkbox in the Edit Events dialog box. You cannot turn off front panel locking for filter events. Refer to the LabVIEW Help for information about caveats when using Event structures and for information about available events.
9-7
Chapter 9
Event-Driven Programming
structures on the block diagram of that VI. When the top-level VI finishes running, LabVIEW sets it and its subVI hierarchy to the idle execution state and automatically unregisters the events. Refer to the examples\general\uievents.llb for examples of using static event registration.
To dynamically register for events on an object, first obtain a VI Server reference to the object. Use the Open Application Reference and Open VI Reference functions to obtain application and VI references. To obtain a reference for a control, use a Property Node to query a VI for its controls or right-click the control and select CreateReference from the shortcut menu to create a control reference constant. Refer to the Application and VI References section of Chapter 17, Programmatically Controlling VIs, for more information about using VI Server references. Use the Register For Events function to dynamically register for events. You can resize the Register For Events node to show one or more event source inputs. Wire an application, VI, or control reference to each event source input. Right-click each input and select which event you want to register for from the Events shortcut menu. The events from which you can select depend on the VI Server reference type you wire to the event source input. The events on the Events shortcut menu are the same events you see in the Edit Events dialog box when you statically register events. When the
9-8
ni.com
Chapter 9
Event-Driven Programming
Register For Events node executes, LabVIEW registers for the specified event on the object associated with each event source input reference. Once you register events, LabVIEW queues events as they occur until an Event structure handles them. Actions that occur before the node executes do not generate events unless another object previously registered for them.
Note
Unlike a Property Node, the Register For Events node does not require you to wire the top left input. Use this input only when you want to modify an existing registration. Refer to the Modifying Registration Dynamically section of this chapter for more information about event re-registration. The dynamic event terminals, available by right-clicking the Event structure and selecting Show Dynamic Event Terminals from the shortcut menu, behave similarly to shift registers. The left terminal accepts an event registration refnum or a cluster of event registration refnums. If you do not wire the inside right terminal, it carries the same data as the left terminal. However, you can wire the event registration refnum or cluster of event registration refnums to the inside right terminal through a Register For Events node and modify the event registration dynamically. Refer to the Modifying Registration Dynamically section of this chapter for more information about using dynamic event terminals. The output of the Register For Events node is an event registration refnum, which is a strict data type LabVIEW uses to propagate information about registered events to the Event structure. You can view the registered events in the Context Help window by idling the cursor over the event registration refnum. After you configure the Register For Events node, wire the event registration refnum output of the Register For Events node to the dynamic event terminal on the left side of an Event structure and configure the Event structure to handle the registered events. Avoid branching an event registration refnum wire because that allows multiple Event structures to pull events from one queue and introduces a race condition that can cause unpredictable behavior. To configure an Event structure to handle a dynamically registered event, use the Edit Events dialog box. The Event Sources section of the dialog box contains a Dynamic subheading that lists each dynamically registered event source. The names of the event sources are the same names as the references you wired to the Register For Events node connected to the Event structure and are listed in the same order. Select the event source you want from the Dynamic list. Notice that the same event you registered using the Register For Events node appears highlighted in the Events section. After you select the event, edit the case to handle the event data according to the application requirements.
9-9
Chapter 9
Event-Driven Programming
Stop event generation by wiring the dynamic event terminal on the right side of the Event Structure to the event registration refnum input of an Unregister For Events function outside the While Loop that contains the Event structure. When the Unregister For Events function executes, LabVIEW unregisters all events the event registration refnum specifies, destroys the event queue associated with the event registration refnum, and discards any events that remain in the queue. If you do not unregister events, and the user performs actions that generate events after the While Loop that contains the Event structure finishes, LabVIEW queues events indefinitely, which can cause the VI to become unresponsive if you configured the events to lock the front panel. In this event, LabVIEW destroys the event queue when the VI goes idle. LabVIEW also unregisters all events automatically when the top-level VI finishes running. However, National Instruments recommends that you unregister events explicitly, especially in a long-running application, to conserve memory resources.
Refer to the LabVIEW Help for more information about how to register events dynamically. Refer to the examples\general\dynamicevents.llb for examples of dynamically registering events.
9-10
ni.com
Chapter 9
Event-Driven Programming
9-11
Chapter 9
Event-Driven Programming
User Events
You programmatically can create and name your own events, called user events, to carry user-defined data. Like queues and notifiers, user events allow different parts of an application to communicate asynchronously. You can handle both user interface and programmatically generated user events in the same Event structure.
9-12
ni.com
Chapter 9
Event-Driven Programming
structure. Use the Edit Events dialog box to configure a case in the Event structure to handle the event. The name of the user event appears under the Dynamic subheading in the Event Sources section of the dialog box. The user event data items appear in the Event Data Node on the left border of the Event structure. User events are notify events and can share the same event case of an Event structure as user interface events or other user events. You can wire a combination of user events and user interface events to the Register For Events node.
9-13
Chapter 9
Event-Driven Programming
LabVIEW unregisters all events and destroys existing user events automatically when the top-level VI finishes running. However, National Instruments recommends that you unregister and destroy user events explicitly, especially in a long-running application, to conserve memory resources.
9-14
ni.com
10
Use strings, arrays, and clusters to group data. Strings group sequences of ASCII characters. Arrays group data elements of the same type. Clusters group data elements of mixed types.
For more information Refer to the LabVIEW Help for more information about grouping data using strings, arrays, and clusters.
Strings
A string is a sequence of displayable or non-displayable ASCII characters. Strings provide a platform-independent format for information and data. Some of the more common applications of strings include the following: Creating simple text messages. Passing numeric data as character strings to instruments and then converting the strings to numerics. Storing numeric data to disk. To store numerics in an ASCII file, you must first convert numerics to strings before writing the numerics to a disk file. Instructing or prompting the user with dialog boxes.
On the front panel, strings appear as tables, text entry boxes, and labels. Edit and manipulate strings with the String functions on the block diagram. You format strings for use in other applications, such as word processing applications and spreadsheets, or for use within other VIs and functions.
10-1
Chapter 10
Display Type Normal Display \ Codes Display Password Display Hex Display
Description Displays printable characters using the font of the control. Non-displayable characters generally appear as boxes. Displays backslash codes for all non-displayable characters. Displays an asterisk (*) for each character including spaces. Displays the ASCII value of each character in hex instead of the character itself.
Message
There are four display types. \ is a backslash. There\sare\sfour\sdisplay\st ypes.\n\\\sis\sa\sbackslash. **************************** ***************** 5468 7572 7970 2062 6572 6520 6172 6520 666F 2064 6973 706C 6179 2074 6573 2E0A 5C20 6973 2061 6163 6B73 6C61 7368 2E
Tables
Use the table control to create a table on the front panel. Each cell in a table is a string, and each cell resides in a column and a row. Therefore, a table is a display for a 2D array of strings. Figure 10-1 shows a table and all its parts. Refer to the Arrays section of this chapter for more information about arrays.
10-2
ni.com
Chapter 10
7 6 3 5
4
1 2 3 4 Cell indicated by index values Column headings Vertical scrollbar Horizontal scrollbar 5 6 7 Row headings Horizontal index Vertical index
Refer to the examples\general\strings.llb for examples of using the String functions to edit strings. Refer to the Memory and Speed Optimization section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about minimizing memory usage when editing strings programmatically.
10-3
Chapter 10
Formatting Strings
To use data in another VI, function, or application, you often must convert the data to a string and then format the string in a way that the VI, function, or application can read. For example, Microsoft Excel expects strings that include delimiters, such as tab, commas, or blank spaces. Excel uses the delimiter to segregate numbers or words into cells. For example, to write a 1D array of numerics to a spreadsheet using the Write File function, you must format the array into a string and separate each numeric with a delimiter, such as a tab. To write an array of numerics to a spreadsheet using the Write to Spreadsheet File VI, you must format the array with the Array to Spreadsheet String function and specify a format and a delimiter. Use the String functions to perform the following tasks: Concatenate two or more strings. Extract a subset of strings from a string. Convert data into strings. Format a string for use in a word processing or spreadsheet application.
Use the File I/O VIs and functions to save strings to text and spreadsheet files.
Format Specifiers
In many cases, you must enter one or more format specifiers in the format string parameter of a String function to format a string. A format specifier is a code that indicates how to convert numeric data to or from a string. LabVIEW uses conversion codes to determine the textual format of the parameter. For example, a format specifier of %x converts a hex integer to or from a string. The Format Into String and Scan From String functions can use multiple format specifiers in the format string parameter, one for each input or output to the expandable function. The Array To Spreadsheet String and Spreadsheet String To Array functions use only one format specifier in the format string parameter because these functions have only one input to convert. LabVIEW treats any extra specifiers you insert into these functions as literal strings with no special meaning.
10-4
ni.com
Chapter 10
10-5
Chapter 10
You can create an XML file for each book. The XML file for a book titled Touring Germanys Great Cathedrals would be similar to the following:
<nonfiction> <Title>Touring Germany's Great Cathedrals</Title> <Author>Tony Walters</Author> <Publisher>Douglas Drive Publishing</Publisher> <PriceUS>$29.99</PriceUS> <Genre>Travel</Genre> <Genre>Architecture</Genre> <Genre>History</Genre> <Synopsis>This book fully illustrates twelve of Germany's most inspiring cathedrals with full-color photographs, scaled cross-sections, and time lines of their construction.</Synopsis> <Pages>224</Pages> </nonfiction>
Similarly, you can classify LabVIEW data by name, value, and type. You can represent a string control for a user name in XML as follows:
<String> <Name>User Name</Name> <Value>Reggie Harmon</Value> </String>
10-6
ni.com
Chapter 10
Use the Unflatten from XML function to convert a data type in the XML format into LabVIEW data. The following example reads the 100 temperatures in the temperatures.xml file and plots the array of temperatures to a chart.
Note
Although you can flatten LabVIEW Variant data to XML, attempting to unflatten variant data from XML results in an empty LabVIEW variant. Refer to the examples\file\XMLex.llb for examples of converting to and from the XML format.
10-7
Chapter 10
Arrays
An array consists of elements and dimensions. Elements are the data that make up the array. A dimension is the length, height, or depth of an array. An array can have one or more dimensions and as many as 231 1 elements per dimension, memory permitting. You can build arrays of numeric, Boolean, path, string, waveform, and cluster data types. Consider using arrays when you work with a collection of similar data and when you perform repetitive computations. Arrays are ideal for storing data you collect from waveforms or data generated in loops, where each iteration of a loop produces one element of the array. You cannot create arrays of arrays. However, you can use a multidimensional array or create an array of clusters where each cluster contains one or more arrays. Refer to the Restrictions for Arrays section of this chapter for more information about the types of elements an array can contain. Refer to the Clusters section of this chapter for more information about clusters.
Indexes
To locate a particular element in an array requires one index per dimension. In LabVIEW, indexes let you navigate through an array and retrieve elements, rows, columns, and pages from an array on the block diagram.
10-8
ni.com
Chapter 10
Examples of Arrays
An example of a simple array is a text array that lists the nine planets of our solar system. LabVIEW represents this as a 1D array of strings with nine elements. Array elements are ordered. An array uses an index so you can readily access any particular element. The index is zero-based, which means it is in the range 0 to n 1, where n is the number of elements in the array. For example, n = 9 for the nine planets, so the index ranges from 0 to 8. Earth is the third planet, so it has an index of 2. Another example of an array is a waveform represented as a numeric array in which each successive element is the voltage value at successive time intervals, as shown in Figure 10-3.
Index Volts
0 0.4
1 0.9
2 1.4
3 0.8
4 0.1
5 0.7
6 0.3
7 0.3
8 0.2
A more complex example of an array is a graph represented as an array of points where each point is a cluster containing a pair of numerics that represent the X and Y coordinates, as shown in Figure 10-4.
0 0.4 0.2
1 2.2 0.5
2 3.3 1.3
3 3.2 2.3
4 2.4 2.6
5 1.8 1.9
6 1.9 1.2
10-9
Chapter 10
The previous examples use 1D arrays. A 2D array stores elements in a grid. It requires a column index and a row index to locate an element, both of which are zero-based. Figure 10-5 shows a 6 column by 4 row 2D array, which contains 6 4 = 24 elements.
Column Index 2 3
0 0 Row Index 1 2 3
For example, a chessboard has eight columns and eight rows for a total of 64 positions. Each position can be empty or have one chess piece. You can represent a chessboard as a 2D array of strings. Each string is the name of the piece that occupies the corresponding location on the board or an empty string if the location is empty. You can generalize the 1D array examples in Figures 10-3 and 10-4 to two dimensions by adding a row to the array. Figure 10-6 shows a collection of waveforms represented as a 2D array of numerics. The row index selects the waveform, and the column index selects the point on the waveform.
Refer to the examples\general\arrays.llb for examples of using arrays. Refer to the Using Loops to Build Arrays section of Chapter 8, Loops and Structures, for more information about building arrays.
10-10
ni.com
Chapter 10
The array shell automatically resizes to accommodate the new object, whether a small Boolean control or a large 3D graph. To create a multidimensional array on the front panel, right-click the index display and select Add Dimension from the shortcut menu. You also can resize the index display until you have as many dimensions as you want. To delete dimensions one at a time, right-click the index display and select Remove Dimension from the shortcut menu. You also can resize the index display to delete dimensions. To display a particular element on the front panel, either type the index number in the index display or use the arrows on the index display to navigate to that number.
10-11
Chapter 10
To create an array constant on the block diagram, select an array constant on the Functions palette, place the array shell on the front panel, and place a string constant, numeric constant, or cluster constant in the array shell. You can use an array constant as a basis for comparison with another array.
1 2
Row Index
Column Index
Rows and columns are zero-based, meaning the first column is column 0, the second column is column 1, and so on. Changing the index display for the following array to row 1, column 2 displays a value of 6. 0 4 8 1 5 9 2 6 10 3 7 11
If you try to display a column or row that is out of the range of the array dimensions, the array control appears dimmed to indicate that there is no value defined, and LabVIEW displays the default value of the data type. The default value of the data type depends on the data type of the array. Use the Positioning tool to resize the array to show more than one row or column at a time.
10-12
ni.com
Chapter 10
Array Functions
Use the Array functions to create and manipulate arrays, such as the following tasks: Extract individual data elements from an array. Insert, delete, or replace data elements in an array. Split arrays.
10-13
Chapter 10
To access multiple consecutive values in an array, expand the Index Array function, but do not wire values to the index inputs in each increment. For example, to retrieve the first, second, and third rows from a 2D array, expand the Index Array function by three increments and wire 1D array indicators to each sub-array output. Refer to the Memory and Speed Optimization section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about minimizing memory usage when using Array functions in a loop.
Clusters
Clusters group data elements of mixed types, such as a bundle of wires, as in a telephone cable, where each wire in the cable represents a different element of the cluster. A cluster is similar to a record or a struct in text-based programming languages. Bundling several data elements into clusters eliminates wire clutter on the block diagram and reduces the number of connector pane terminals that subVIs need. The connector pane has, at most, 28 terminals. If your front panel contains more than 28 controls and indicators that you want to use programmatically, group some of them into a cluster and assign the cluster to a terminal on the connector pane. Although cluster and array elements are both ordered, you must unbundle all cluster elements at once rather than index one element at a time. You also can use the Unbundle By Name function to access specific cluster elements. Clusters also differ from arrays in that they are a fixed size. Like an array, a cluster is either a control or an indicator. A cluster cannot contain a mixture of controls and indicators. Most clusters on the block diagram have a pink wire pattern and data type terminal. Clusters of numerics, sometimes referred to as points, have a brown wire pattern and data type terminal. You can wire brown numeric clusters to Numeric functions, such as Add or Square Root, to perform the same operation simultaneously on all elements of the cluster. Cluster elements have a logical order unrelated to their position in the shell. The first object you place in the cluster is element 0, the second is element 1, and so on. If you delete an element, the order adjusts automatically. The cluster order determines the order in which the elements appear as terminals on the Bundle and Unbundle functions on the block diagram. You can view and modify the cluster order by right-clicking the
10-14
ni.com
Chapter 10
cluster border and selecting Reorder Controls In Cluster from the shortcut menu. To wire clusters, both clusters must have the same number of elements. Corresponding elements, determined by the cluster order, must have compatible data types. For example, if a double-precision floating-point numeric in one cluster corresponds in cluster order to a string in the another cluster, the wire on the block diagram appears broken and the VI does not run. If numerics of different representations, LabVIEW coerces them to the same representation. Refer to the Numeric Conversion section of Appendix B, Polymorphic Functions, for more information about numeric conversion. Use the Cluster functions to create and manipulate clusters. For example, you can perform the following tasks: Extract individual data elements from a cluster. Add individual data elements to a cluster. Break a cluster out into its individual data elements.
10-15
11
In LabVIEW, you read data from or write data to a front panel object using its block diagram terminal. However, a front panel object has only one block diagram terminal, and your application might need to access the data in that terminal from more than one location. Local and global variables pass information between locations in your application that you cannot connect with a wire. Use local variables to access front panel objects from more than one location in a single VI. Use global variables to access and pass data among several VIs.
For more information Refer to the LabVIEW Help for more information about using local and global variables.
Local Variables
Use local variables to access front panel objects from more than one location in a single VI and pass data between block diagram structures that you cannot connect with a wire. With a local variable, you can write to or read from a control or indicator on the front panel. Writing to a local variable is similar to passing data to any other terminal. However, with a local variable you can write to it even if it is a control or read from it even if it is an indicator. In effect, with a local variable, you can access a front panel object as both an input and an output. For example, if the user interface requires users to log in, you can clear the Login and Password prompts each time a new user logs in. Use a local variable to read from the Login and Password string controls when a user logs in and to write empty strings to these controls when the user logs out.
11-1
Chapter 11
Global Variables
Use global variables to access and pass data among several VIs that run simultaneously. Global variables are built-in LabVIEW objects. When you create a global variable, LabVIEW automatically creates a special global VI, which has a front panel but no block diagram. Add controls and indicators to the front panel of the global VI to define the data types of the global variables it contains. In effect, this front panel is a container from which several VIs can access data. For example, suppose you have two VIs running simultaneously. Each VI contains a While Loop and writes data points to a waveform chart. The first VI contains a Boolean control to terminate both VIs. You must use a global variable to terminate both loops with a single Boolean control. If both loops were on a single block diagram within the same VI, you could use a local variable to terminate the loops.
11-2
ni.com
Chapter 11
LabVIEW uses owned labels to identify global variables, so label the front panel controls and indicators with descriptive owned labels. Refer to the Labeling section of Chapter 4, Building the Front Panel, for more information about owned and free labels. You can create several single global VIs, each with one front panel object, or you can create one global VI with multiple front panel objects. A global VI with multiple objects is more efficient because you can group related variables together. The block diagram of a VI can include several global variable nodes that are associated with controls and indicators on the front panel of a global VI. These global variable nodes are either copies of the first global variable node that you placed on the block diagram of the global VI, or they are the global variable nodes of global VIs that you placed on the current VI. You place global VIs on other VIs the same way you place subVIs on other VIs. Each time you place a new global variable node on a block diagram, LabVIEW creates a new VI associated only with that global variable node and copies of it. Refer to the SubVIs section of Chapter 7, Creating VIs and SubVIs, for more information about subVIs. After you finish placing objects on the global VI front panel, save it and return to the block diagram of the original VI. You must then select the object in the global VI that you want to access. Right-click the global variable node and select a front panel object from the Select Item shortcut menu. The shortcut menu lists all the front panel objects that have owned labels.
11-3
Chapter 11
On the block diagram, you can distinguish read locals or globals from write locals or globals the same way you distinguish controls from indicators. A read local or global has a thick border similar to a control. A write local or global has a thin border similar to an indicator. Refer to the examples\general\locals.llb and examples\ general\globals.llb for examples of using local and global variables.
Race Conditions
A race condition occurs when two or more pieces of code that execute in parallel change the value of the same shared resource, typically a local or global variable. Figure 11-1 shows an example of a race condition.
11-4
ni.com
Chapter 11
The output of this VI depends on the order in which the operations run. Because there is no data dependency between the two operations, there is no way to determine which runs first. To avoid race conditions, do not write to the same variable you read from. Refer to the Data Dependency and Artificial Data Dependency section of Chapter 5, Building the Block Diagram, for more information about data dependency.
11-5
12
Use graphs and charts to display data in a graphical form. Graphs and charts differ in the way they display and update data. VIs with graphs usually collect the data in an array and then plot the data to the graph, which is similar to a spreadsheet that first stores the data then generates a plot of it. In contrast, a chart appends new data points to those already in the display to create a history. On a chart, you can see the current reading or measurement in context with data previously acquired.
For more information Refer to the LabVIEW Help for more information about using graphs and charts.
object on the front panel. Refer to examples\general\graphs for examples of graphs and charts.
12-1
Chapter 12
Anti-aliased line drawing is not available on digital waveform graphs. To enable anti-aliased line plots, right-click the plot legend and select Anti-aliased from the shortcut menu. If the plot legend is not visible, right-click the graph or chart and select Visible ItemsPlot Legend from the shortcut menu.
Note Because anti-aliased line drawing can be computation intensive, using anti-aliased line plots can slow performance.
12-2
ni.com
Chapter 12
Customizing Graphs
You can modify the behavior of graph cursors, scaling options, and graph axes. Figure 12-1 illustrates the elements of a graph. You can customize the waveform and intensity graphs to match your data display requirements or to display more information. Options available for charts include a scrollbar, a legend, a palette, a digital display, and representation of scales with respect to time.
12-3
Chapter 12
11
1 2
3 4 5 10 9 6
1 2 3
4 5 6
7 8 9
10 Y-scale 11 Label
You add most of the items listed in the legend above by right-clicking the graph, selecting Visible Items from the shortcut menu, and selecting the appropriate element.
Graph Cursors
Cursors on graphs allow you to read the exact value of a point on a plot. The cursor value displays in the cursor legend. Add a cursor to a graph by right-clicking the graph, selecting Visible ItemsCursor Legend from the shortcut menu, and clicking anywhere in a cursor legend row to activate a cursor. Use the Positioning tool to expand the cursor legend to add multiple cursors. You can place cursors and a cursor display on all graphs, and you can label the cursor on the plot. You can set a cursor to lock onto a plot, and you can move multiple cursors at the same time. A graph can have any number of cursors.
12-4
ni.com
Chapter 12
Autoscaling
Graphs can automatically adjust their horizontal and vertical scales to reflect the data you wire to them. This behavior is called autoscaling. Turn autoscaling on or off by right-clicking the graph and selecting X Scale Autoscale X or Y ScaleAutoscale Y from the shortcut menu. By default, autoscaling is enabled for graphs. However, autoscaling can slow performance. Use the Operating or Labeling tool to change the horizontal or vertical scale directly.
Axis Formatting
Use the Format and Precision tab of the Graph Properties and Chart Properties dialog boxes to specify how the x-axis and y-axis appear on the graph or chart. By default, the x-axis is configured to use floating-point notation and with a label of Time, and the y-axis is configured to use automatic formatting and with a label of Amplitude. Right-click the graph or chart and select Properties to display the Graph Properties dialog box or Chart Properties dialog box to configure the axes for the graph or chart. Use the Format and Precision tab of the Graph Properties or Chart Properties dialog box to specify a numeric format for the axes of a graph or chart. Select the Scales tab to rename the axis and to format the appearance of the axis scale. By default, a graph or chart axis displays up to six digits before automatically switching to exponential notation. Place a checkmark in the Direct entry mode preferred checkbox to display the text options that let you enter format strings directly. Enter format strings to customize the appearance of the scales and numeric precision of the axes. Refer to the Using Format Strings topic of the LabVIEW Help for more information about formatting strings.
12-5
Chapter 12
Customizing Charts
Unlike graphs, which display an entire waveform that overwrites the data already stored, charts update periodically and maintain a history of the data previously stored. You can customize the waveform and intensity charts to match your data display requirements or to display more information. Options available for charts include a scrollbar, a legend, a palette, a digital display, and representation of scales with respect to time. You can modify the behavior of chart history length, update modes, and plot displays.
12-6
ni.com
Chapter 12
12-7
Chapter 12
Right-click the chart and select Stack Plots from the shortcut menu to view the chart plots as multiple vertical scales. Right-click the chart and select Overlay Plots to view the chart plots as a single vertical scale. Refer to the Charts VI in the examples\general\graphs\charts.llb for examples of different kinds of charts and the data types they accept.
12-8
ni.com
Chapter 12
The waveform graph plots only single-valued functions, as in y = f(x), with points evenly distributed along the x-axis, such as acquired time-varying waveforms. The XY graph is a general-purpose, Cartesian graphing object that plots multivalued functions, such as circular shapes or waveforms with a varying timebase. Both graphs can display plots containing any number of points. Both types of graphs accept several data types, which minimizes the extent to which you must manipulate data before you display it.
12-9
Chapter 12
A multiplot waveform graph accepts a plot array where the array contains clusters. Each cluster contains a point array that contains the y data. The inner array describes the points in a plot, and the outer array has one cluster for each plot. Figure 12-4 shows this array of the y cluster.
Use a multiplot waveform graph instead of a 2D array if the number of elements in each plot is different. For example, when you sample data from several channels using different time amounts from each channel, use this data structure instead of a 2D array because each row of a 2D array must have the same number of elements. The number of elements in the interior arrays of an array of clusters can vary. Refer to the (Y) Multi Plot 2 graph in the Waveform Graph VI in the examples\general\graphs\ gengraph.llb for an example of a graph that accepts this data type. A multiplot waveform graph accepts a cluster of an initial x value, a x value, and array that contains clusters. Each cluster contains a point array that contains the y data. You use the Bundle function to bundle the arrays into clusters and you use the Build Array function to build the resulting clusters into an array. You also can use the Build Cluster Array, which creates arrays of clusters that contain inputs you specify. Refer to the (Xo, dX, Y) Multi Plot 2 graph in the Waveform Graph VI in the examples\general\graphs\gengraph.llb for an example of a graph that accepts this data type. A multiplot waveform graph accepts an array of clusters of an x value, a x value, and an array of y data. This is the most general of the multiplot waveform graph data types because you can indicate a unique starting point and increment for the x-axis of each plot. Refer to the (Xo, dX, Y) Multi Plot 1 graph in the Waveform Graph VI in the examples\general\ graphs\gengraph.llb for an example of a graph that accepts this data type.
12-10
ni.com
Chapter 12
Refer to the XY Graph VI in the examples\general\graph\ gengraph.llb for an example of single-plot XY graph data types.
Waveform Charts
The waveform chart is a special type of numeric indicator that displays one or more plots. Refer to the examples\general\graphs\charts.llb for examples of waveform charts. If you pass charts a single value or multiple values at a time, LabVIEW interprets the data as points on the chart and increments the x index by one starting at x = 0. The chart treats these inputs as new data for a single plot. If you pass charts the waveform data type, the x index conforms to the time format specified. The frequency at which you send data to the chart determines how often the chart redraws. To pass data for multiple plots to a waveform chart, you can bundle the data together into a cluster of scalar numerics, where each numeric represents a single point for each of the plots. If you want to pass multiple points for plots in a single update, wire an array of clusters of numerics to the chart. Each numeric represents a single y value point for each of the plots. If you cannot determine the number of plots you want to display until run time, or you want to pass multiple points for multiple plots in a single update, wire a 2D array of numerics or waveforms to the chart. As with the waveform graph, by default, waveform charts handle rows as new data for each plot. Wire a 2D array data type to the chart, right-click the chart, and select Transpose Array from the shortcut menu to treat columns in the array as new data for each plot.
12-11
Chapter 12
The rows of the data pass into the display as new columns on the graph or chart. If you want rows to appear as rows on the display, wire a 2D array data type to the graph or chart, right-click the graph or chart, and select Transpose Array from the shortcut menu. The array indexes correspond to the lower left vertex of the block of color. The block of color has a unit area, which is the area between the two points,
12-12
ni.com
Chapter 12
as defined by the array indexes. The intensity graph or chart can display up to 256 discrete colors. After you plot a block of data on an intensity chart, the origin of the Cartesian plane shifts to the right of the last data block. When the chart processes new data, the new data appear to the right of the old data. When a chart display is full, the oldest data scroll off the left side of the chart. This behavior is similar to the behavior of strip charts. Refer to the Chart Update Modes section of this chapter for more information about these charts. Refer to the examples\general\graphs\intgraph.llb for examples of intensity charts and graphs.
Color Mapping
You can set the color mapping interactively for intensity graphs and charts the same way you define the colors for a color ramp numeric control. Refer to the Color Ramps section of Chapter 4, Building the Front Panel, for more information about color ramps. You can set the color mapping for the intensity graph and chart programmatically by using the Property Node in two ways. Typically, you specify the value-to-color mappings in the Property Node. For this method, specify the Z Scale: Marker Values property. This property consists of an array of clusters, in which each cluster contains a numeric limit value and the corresponding color to display for that value. When you specify the color mapping in this manner, you can specify an upper out-of-range color using the Z Scale: High Color property and a lower out-of-range color using the Z Scale: Low Color property. The intensity graph and chart is limited to a total of 254 colors, with the lower and upper out-of-range colors bringing the total to 256 colors. If you specify more than 254 colors, the intensity graph or chart creates the 254-color table by interpolating among the specified colors. If you display a bitmap on the intensity graph, you specify a color table using the Color Table property. With this method, you can specify an array of up to 256 colors. Data passed to the chart are mapped to indexes in this color table based on the color scale of the intensity chart. If the color scale ranges from 0 to 100, a value of 0 in the data is mapped to index 1, and a value of 100 is mapped to index 254, with interior values interpolated between 1 and 254. Anything below 0 is mapped to the out-of-range below color (index 0), and anything above 100 is mapped to the out-of-range above color (index 255).
12-13
Chapter 12
Note
The colors you want the intensity graph or chart to display are limited to the exact colors and number of colors your video card can display. You also are limited by the number of colors allocated for your display.
12-14
ni.com
Chapter 12
The digital waveform graph in Figure 12-6 plots digital data on a single plot. The VI converts the numbers in the Numbers array to digital data and displays the binary representations of the numbers in the Binary Representations digital data indicator. In the digital graph, the number 0 appears without a top line to symbolize that all the bit values are zero. The number 255 appears without a bottom line to symbolize that all the bit values are 1.
Refer to the LabVIEW Help for more information about configuring the plots of the digital waveform graph. To plot each sample of digital data, right-click the y-axis and select Expand Digital Buses from the shortcut menu. Each plot represents a different sample. The digital waveform graph in Figure 12-7 displays the six numbers in the Numbers digital array control.
12-15
Chapter 12
The Binary Representations digital control displays the binary representations of the numbers. Each column in the table represents a bit. For example, the number 89 requires 7 bits of memory (the 0 in column 7 indicates an unused bit). Point 3 on the digital waveform graph plots the 7 bits necessary to represent the number 89 and a value of zero to represent the unused eighth bit on plot 7. The VI in Figure 12-8 converts an array of numbers to digital data and uses the Build Waveform function to assemble the start time, delta t, and the numbers entered in a digital data control and to display the digital data.
Refer to the Digital Waveform Control and Digital Data Control sections in Chapter 4, Building the Front Panel, for more information about the digital data control, the digital waveform data type, and converting data to digital data.
12-16
ni.com
Chapter 12
Masking Data
The VI in Figure 12-7 produces a graph in which each plot represents one bit in the data. You also can select, reorder, and combine bits in the data before you display it on the graph. Selecting, reordering, and combining bits is called masking the data. Use a mask to combine the plots of two or more different bits and display them on a single plot. If you have an array of 8-bit integers, you can plot up to 8 bits on a single plot. If you have an array of 16-bit integers, you can display up to 16 bits on a single plot, and so on. You also can plot the same bit two or more times on a single plot.
3D Graphs
Note
3D graph controls are available only on Windows in the LabVIEW Full and Professional Development Systems. For many real-world data sets, such as the temperature distribution on a surface, joint time-frequency analysis, and the motion of an airplane, you need to visualize data in three dimensions. With the 3D graphs, you can visualize three-dimensional data and alter the way that data appears by modifying the 3D graph properties. The following 3D graphs are available: 3D SurfaceDraws a surface in 3D space. When you drop this control on the front panel, LabVIEW wires it to a subVI that receives the data that represent the surface. 3D ParametricDraws a complex surface in 3D space. When you drop this control on the front panel, LabVIEW wires it to a subVI that receives the data that represent the surface. 3D CurveDraws a line in 3D space. When you drop this control on the front panel, LabVIEW wires it to a subVI that receives the data that represent the line.
Use the 3D graphs in conjunction with the 3D Graph VIs to plot curves and surfaces. A curve contains individual points on the graph, each point having an x, y, and z coordinate. The VI then connects these points with a line. A curve is ideal for visualizing the path of a moving object, such as the flight path of an airplane.
12-17
Chapter 12
The 3D graphs use ActiveX technology and VIs that handle 3D representation. You can set properties for the 3D Graph Properties VIs to change behavior at run time, including setting basic, axes, grid, and projection properties. A surface plot uses x, y, and z data to plot points on the graph. The surface plot then connects these points, forming a three-dimensional surface view of the data. For example, you could use a surface plot for terrain mapping. When you select a 3D graph, LabVIEW places an ActiveX container on the front panel that contains a 3D graph control. LabVIEW also places a reference to the 3D graph control on the block diagram. LabVIEW wires this reference to one of the three 3D Graph VIs.
12-18
ni.com
13
Use the Graphics and Sound VIs to display or modify graphics and sound in VIs.
For more information Refer to the LabVIEW Help for more information about using graphics and sound in VIs.
13-1
Chapter 13
When you place a picture indicator on the front panel, it appears as a blank rectangular area, and a corresponding terminal, shown at left, appears on the block diagram. To display an image in a picture indicator, you must write an image to the indicator programmatically. You cannot copy an image to the clipboard and paste it into the picture indicator. You can use the Picture Functions VIs to specify a set of drawing instructions. Each VI takes a set of inputs that describes a drawing instruction. Based on these inputs, the VI creates a compact description of these specifications that you pass to the picture indicator for display. Refer to the Picture Functions VIs section of this chapter for more information about using the Picture Functions VIs to display an image in a picture indicator.
13-2
ni.com
Chapter 13
13-3
Chapter 13
The Smith Plot VIs provide a large amount of functionality in each single VI. Consequently, many of these VIs include complicated clusters for inputs. You can use default values and custom controls to decrease the complexity of the VIs. Instead of creating the default cluster input, copy a custom control from the Smith Plot example VIs in the examples\ picture\demos.llb and place it on the front panel. If you are graphing load impedances, you can represent an impedance as a complex number of the form r + jx. To avoid losing detail in the Smith plot, use the Normalize Smith Plot VI to normalize the data. You can pass the data you normalize with the Normalize Smith Plot VI directly to the Smith Plot VI. You usually scale Smith plot data with respect to the characteristic impedance (Z0) of the system.
13-4
ni.com
Chapter 13
The third row of the Picture Functions palette contains VIs you use to draw text in a picture. The Get Text Rect VI does not draw any text. Instead, you use it to calculate the size of a bounding rectangle of a string. The fourth row of the Picture Functions palette contains VIs you use to draw flattened and unflattened pixmaps in a picture, to apply a mask to an image, to obtain a subset of a source image, and to convert a picture data type to a flattened image data cluster. The last row of the Picture Functions palette contains the empty picture constant, which you use when you need to start with or make changes to an empty picture. The last row of the palette also contains VIs you use to convert red, green, and blue values to the corresponding RGB color and to convert a color to its respective red, green, and blue components. You can wire the pictures you create with the Picture Functions VIs only to a picture indicator or to the picture input of a Picture Functions VI. LabVIEW draws the picture when it updates the picture indicator on an open front panel. Each Picture Functions VI concatenates its drawing instruction to the drawing instructions wired to the picture input and returns the concatenated drawing instructions in the new picture output. The following block diagram uses the Draw Rect VI to draw two overlapping rectangles.
13-5
Chapter 13
Bitmap data are 2D arrays in which each point varies depending on the color depth. For example, in a black-and-white, or 1-bit, image, each point is Boolean. In 4-bit and 8-bit images, each point is an index in a color table. For 24-bit true-color images, each point is a mixture of red, green, and blue (RGB) values. The VIs that read and write graphics files work with data in a simple, flattened format that is closer to the way graphics files are written to disk, with the data stored in a 1D array. These graphics files are pixmaps, which are similar in concept to bitmaps. You can display this flattened data directly using the Draw Flattened Pixmap VI. To manipulate the data as a 2D array, you can convert it to the appropriate format using the Unflatten Pixmap VI and Flatten Pixmap VI.
13-6
ni.com
Chapter 13
Sound VIs
Use the Sound VIs to integrate sound files and functions into your VIs. You can use these VIs to perform the following tasks: Create VIs that play sound files, such as a recorded warning, when users perform certain actions. Create a VI that plays a sound file when the VI starts or finishes running or when you reach a certain point in the VI. Configure a sound input device to acquire sound data. Use the Sound Input VIs to acquire the sound data. You also can read any sound information coming through the device. Configure a sound output device to accept sound data from other Sound VIs. You can control the volume of the sound going through the device, play or pause the sound, and clear the sound from your system.
13-7
File I/O
14
File I/O operations pass data to and from files. Use the File I/O VIs and functions to handle all aspects of file I/O, including the following: Opening and closing data files. Reading data from and writing data to files. Reading from and writing to spreadsheet-formatted files. Moving and renaming files and directories. Changing file characteristics. Creating, modifying, and reading a configuration file.
Use the high-level VIs to perform common I/O operations. Use the low-level VIs and functions to control each file I/O operation individually.
For more information Refer to the LabVIEW Help for more information about performing file I/O operations.
2. 3.
Most File I/O VIs and functions perform only one step in a file I/O operation. However, some high-level File I/O VIs designed for common file I/O operations perform all three steps. Although these VIs are not always as efficient as the low-level functions, you might find them easier to use.
14-1
Chapter 14
File I/O
14-2
ni.com
Chapter 14
File I/O
In addition, it is difficult to randomly access numeric data in text files. Although each character in a string takes up exactly 1 byte of space, the space required to express a number as text typically is not fixed. To find the ninth number in a text file, LabVIEW must first read and convert the preceding eight numbers. You might lose precision if you store numeric data in text files. Computers store numeric data as binary data, and typically you write numeric data to a text file in decimal notation. A loss of precision might occur when you write the data to the text file. Loss of precision is not an issue with binary files. Refer to the examples\file\smplfile.llb and examples\ file\sprdsht.llb for examples of using file I/O with text files.
Refer to the Read Binary File and Write Binary File VIs in the examples\ file\smplfile.llb for examples of reading and writing an array of double-precision floating-point values to and from a binary file, respectively.
14-3
Chapter 14
File I/O
14-4
ni.com
Chapter 14
File I/O
You can save time and programming effort by using the high-level VIs to write to and read from files. The high-level VIs perform read or write operations in addition to opening and closing the file. Avoid placing the high-level VIs in loops, because the VIs perform open and close operations each time they run. Refer to the Disk Streaming section of this chapter for more information about keeping files open while you perform multiple operations. The high-level VIs expect a file path input. If you do not wire a file path, a dialog box appears for you to specify a file to read from or write to. If an error occurs, the high-level VIs display a dialog box that describes the error. You can choose to halt execution or to continue. Figure 14-1 shows how to use the high-level Write To Spreadsheet File VI to send numbers to a Microsoft Excel spreadsheet file. When you run this VI, LabVIEW prompts you to write the data to an existing file or to create a new file.
Use the Binary File VIs to read from and write to files in binary format. Data can be integers or single-precision floating-point numerics.
14-5
Chapter 14
File I/O
A path, shown at left, is a LabVIEW data type that identifies the location of a file on disk. The path describes the volume that contains the file, the directories between the top-level of the file system and the file, and the name of the file. Enter or display a path using the standard syntax for a given platform with the path control or indicator. Refer to the Path Controls and Indicators section of Chapter 4, Building the Front Panel, for more information about path controls and indicators. Figure 14-2 shows how to use low-level VIs and functions to send numbers to a Microsoft Excel spreadsheet file. When you run this VI, the Open/Create/Replace VI opens the numbers.xls file. The Write File function writes the string of numbers to the file. The Close function closes the file. If you do not close the file, the file stays in memory and is not accessible from other applications or to other users.
14-6
ni.com
Chapter 14
File I/O
Compare the VI in Figure 14-2 to the VI in Figure 14-1, which completes the same task. In Figure 14-2, you have to use the Array To Spreadsheet String function to format the array of numbers as a string. The Write To Spreadsheet File VI in Figure 14-1 opens the file, converts the array of numbers to a string, and closes the file. Refer to the Write Datalog File Example VI in the examples\file\ datalog.llb for an example of using low-level File I/O VIs and functions.
Disk Streaming
You also can use the low-level File I/O VIs and functions for disk streaming, which saves memory resources. Disk streaming is a technique for keeping files open while you perform multiple write operations, for example, within a loop. Although the high-level write operations are easy to use, they add the overhead of opening and closing the file each time they execute. Your VIs can be more efficient if you avoid opening and closing the same files frequently. Disk streaming reduces the number of times the function interacts with the operating system to open and close the file. To create a typical disk-streaming operation, place the Open/Create/Replace File VI before the loop and the Close File function after the loop. Continuous writing to a file then can occur within the loop without the overhead associated with opening and closing the file. Disk streaming is ideal in lengthy data acquisition operations where speed is critical. You can write data continuously to a file while acquisition is still in progress. For best results, avoid running other VIs and functions, such as Analyze VIs and functions, until you complete the acquisition.
National Instruments Corporation 14-7 LabVIEW User Manual
Chapter 14
File I/O
14-8
ni.com
Chapter 14
File I/O
you can use this function instead of reading data from a file with the Read File function or Read Characters From File VI and scanning the resulting string with the Scan From String function.
14-9
Chapter 14
File I/O
14-10
ni.com
Chapter 14
File I/O
The Read Waveform from File VI also reads multiple waveforms from a file. The VI returns an array of waveform data types, which you can display in a multiplot graph. If you want to access a single waveform from a file, you must index the array of waveform data types, as shown in Figure 14-5. Refer to the Arrays section of Chapter 10, Grouping Data Using Strings, Arrays, and Clusters, for more information about indexing arrays. The VI accesses a file that includes multiple waveforms. The Index Array function reads the first and third waveforms in the file and plots them on two separate waveform graphs. Refer to Chapter 8, Loops and Structures, for more information about graphs.
Flow-Through Parameters
Many File I/O VIs and functions contain flow-through parameters, typically a refnum or path, that return the same value as the corresponding input parameter. Use these parameters to control the execution order of the functions. By wiring the flow-through output of the first node you want to execute to the corresponding input of the next node you want to execute, you create artificial data dependency. Without these flow-through parameters, you have to use sequence structures to ensure that file I/O operations take place in the order you want. Refer to the Data Dependency and Artificial Data Dependency section of Chapter 5, Building the Block Diagram, for more information about artificial data dependency.
14-11
Chapter 14
File I/O
The standard extension for Windows configuration settings files is .ini, but the Configuration File VIs work with files with any extension, provided the content is in the correct format. Refer to the Windows Configuration Settings File Format section of this chapter for more information about configuring the content.
You can use the Configuration File VIs to read this data, as shown in Figure 14-6. This VI uses the Read Key VI to read the key named Value from the section called Data. This VI works regardless of how the file changes, provided the file remains in the Windows configuration settings file format.
14-12
ni.com
Chapter 14
File I/O
Use the following data types with Configuration File VIs for the value portion of the key parameter: String Path Boolean 64-bit double-precision floating-point numeric 32-bit signed integer 32-bit unsigned integer
The Configuration File VIs can read and write raw or escaped string data. The VIs read and write raw data byte-for-byte, without converting the data to ASCII. In converted, or escaped, strings LabVIEW stores any non-displayable text characters in the configuration settings file with the equivalent hexadecimal escape codes, such as \0D for a carriage return. In addition, LabVIEW stores backslash characters in the configuration
14-13
Chapter 14
File I/O
settings file as double backslashes, such as \\ for \. Set the read raw string? or write raw string? inputs of the Configuration File VIs to TRUE for raw data and to FALSE for escaped data. When VIs write to a configuration file, they place quotation marks around any string or path data that contain a space character. If a string contains quotation marks, LabVIEW stores them as \". If you read and/or write to configuration files using a text editor, you might notice that LabVIEW replaced quotation marks with \". LabVIEW stores path data in a platform-independent format, the standard UNIX format for paths, in .ini files. The VIs interpret the absolute path /c/temp/data.dat stored in a configuration settings file as follows:
(Windows) c:\temp\data.dat (Mac OS) c:temp:data.dat (UNIX) /c/temp/data.dat
Each VI maintains a log-file binding that records the location of the datalog file where LabVIEW maintains the logged front panel data. Log-file binding is the association between a VI and the datalog file to which you log the VI data.
14-14
ni.com
Chapter 14
File I/O
A datalog file contains records that include a time stamp and the data from each time you ran the VI. When you access a datalog file, you select which record you want by running the VI in retrieval mode and using the front panel controls to view the data. When you run the VI in retrieval mode, a numeric control appears at the top of the front panel, so you can navigate among the records. Refer to Figure 14-7 for an example of this numeric control.
A waveform chart logs only one data point at a time with front panel datalogging. If you wire an array to the chart indicator, the datalog file contains a subset of the array the chart displays.
The highlighted number indicates the data record you are viewing. The numbers in square brackets indicate the range of records you logged for the current VI. You log a record each time you run the VI. The date and time indicate when you logged the selected record. View the next or previous record by clicking the increment or decrement arrows. You also can use the up and down arrow keys on your keyboard. In addition to the data retrieval toolbar, the front panel appearance changes according to the record you select on the toolbar. For example, when you
14-15
Chapter 14
File I/O
click the increment arrow and advance to another record, the controls and indicator display the data for that particular record at the time you logged the data. Click the OK button to exit retrieval mode and return to the VI whose datalog file you were viewing.
Deleting a Record
While in retrieval mode, you can delete specific records. Mark for deletion an individual record in retrieval mode by viewing that record and clicking the Trash button. If you click the Trash button again, the record is no longer marked for deletion. Select OperateData LoggingPurge Data while in retrieval mode to delete all the records you marked for deletion. If you do not delete your marked record before you click the OK button, LabVIEW prompts you to delete the marked records.
14-16
ni.com
Chapter 14
File I/O
The yellow box that looks like a filing cabinet includes terminals for accessing data from the datalog file. When you enable database access for the subVI, the inputs and outputs of the subVI actually act as outputs, returning their logged data. record # indicates the record to retrieve, invalid record # indicates whether the record number exists, timestamp is the time the record was created, and front panel data is a cluster of the front panel objects. You can access the data of a front panel object by wiring the front panel data cluster to the Unbundle function. You also can retrieve values for specific inputs and outputs by wiring directly to the corresponding terminal on the subVI, as shown in Figure 14-9.
14-17
Chapter 14
File I/O
If you run the VI, the subVI does not run. Instead, it returns the logged data from its front panel to the VI front panel as a cluster.
Note
If you display a subVI or an Express VI as an expandable node, you cannot enable database access for that node.
Specifying Records
The subVI has n logged records, and you can wire any number from n to n 1 to the record # terminal of the subVI. You can access records relative to the first logged record using non-negative record numbers. 0 represents the first record, 1 represents the second record, and so on, through n 1, which represents the last record. You can access records relative to the last logged record using negative record numbers. 1 represents the last record, 2 represents the second to the last, and so on, through n, which represents the first record. If you wire a number outside the range n to n 1 to the record # terminal, the invalid record # output is TRUE, and the subVI retrieves no data.
14-18
ni.com
Chapter 14
File I/O
Figure 14-10. Retrieving Logged Data Using the File Open Function
14-19
Chapter 14
File I/O
14-20
ni.com
15
The Documenting VIs section of this chapter describes how to record information about the block diagram and/or the front panel at any stage of development in printed documentation about VIs. The Printing VIs section of this chapter describes options for printing VIs. Some options are more appropriate for printing information about VIs, and others are more appropriate for reporting the data and results the VIs generate. Several factors affect which printing method you use, including if you want to print manually or programmatically, how many options you need for the report format, if you need the functionality in the stand-alone applications you build, and on which platforms you run the VIs.
For more information Refer to the LabVIEW Help for more information about documenting and printing VIs and generating reports.
Documenting VIs
You can use LabVIEW to track development, document a finished VI, and create instructions for users of VIs. You can view documentation within LabVIEW, print it, and save it to HTML, RTF, or text files. To create effective documentation for VIs, add comments to the VI revision history and create VI and object descriptions.
15-1
Chapter 15
section of this chapter for more information about printing the revision history or saving it to a file.
Revision Numbers
The revision number is an easy way to track changes to a VI. The revision number starts at zero and increases incrementally every time you save the VI. To display the current revision number in the title bar of the VI and the title bar of the History window, select ToolsOptions, select Revision History from the top pull-down menu, and place a checkmark in the Show revision number in titlebar checkbox. The number LabVIEW displays in the History window is the next revision number, which is the current revision number plus one. When you add a comment to the history, the header of the comment includes the next revision number. The revision number does not increase when you save a VI if you change only the history. Revision numbers are independent of comments in the History window. Gaps in revision numbers between comments indicate that you saved the VI without a comment. Because the history is strictly a development tool, LabVIEW automatically removes the history when you remove the block diagram of a VI. Refer to the Distributing VIs section of Chapter 7, Creating VIs and SubVIs, for more information about removing the block diagram. The History window is not available in the run-time version of a VI. The General page of the VI Properties dialog box displays the revision number, even for VIs without block diagrams. Click the Reset button in the History window to erase the revision history and reset the revision number to zero.
15-2
ni.com
Chapter 15
Help window when you move the cursor over the VI icon or object, respectively.
Printing Documentation
Select FilePrint to print VI documentation or save it to HTML, RTF, or text files. You can select a built-in format or create a custom format for documentation. The documentation you create can include the following items: Icon and connector pane Front panel and block diagram Controls, indicators, and data type terminals VI and object descriptions VI hierarchy List of subVIs Revision history
Note The documentation you create for certain types of VIs cannot include all the previous items. For example, a polymorphic VI does not have a front panel or a block diagram, so you cannot include those items in the documentation you create for a polymorphic VI.
15-3
Chapter 15
Chapter 15
You can compile the RTF files LabVIEW generates into a (Windows) WinHelp, (Mac OS) QuickHelp, or (UNIX) HyperHelp file. Create links from VIs to HTML files or compiled help files by selecting FileVI Properties and selecting Documentation from the Category pull-down menu.
Printing VIs
You can use the following primary methods to print VIs: Select FilePrint Window to print the contents of the active window. Select FilePrint to print more comprehensive information about a VI, including information about the front panel, block diagram, subVIs, controls, VI history, and so on. Refer to the Printing Documentation section of this chapter for more information about using this method to print VIs. Use the VI Server to programmatically print any VI window or VI documentation at any time. Refer to Chapter 17, Programmatically Controlling VIs, for more information about using this method to print VIs.
15-5
Chapter 15
Note
If you print VI documentation from a built application, you can print only the front panels.
15-6
ni.com
Chapter 15
Create a subVI and format the front panel the way you want LabVIEW to print it. Instead of selecting OperatePrint at Completion in the higher level VI, select it in the subVI. When you want to print, call the subVI and wire the data you want to print to the subVI.
You can generate reports only in the LabVIEW Full and Professional Development Systems. Use the Report Generation VIs to perform the following tasks: Append text, graphics, tables, or VI documentation to a report. Set text font, size, style, and color. Set the report orientationportrait or landscape. Set the report headers and footers. Set margins and tabs.
15-7
Customizing VIs
16
You can configure VIs and subVIs to work according to your application needs. For example, if you plan to use a VI as a subVI that requires user input, configure the VI so that its front panel appears each time you call it. You can configure a VI in many ways, either within the VI itself or programmatically by using the VI Server. Refer to Chapter 17, Programmatically Controlling VIs, for more information about using the VI Server to configure how a VI behaves.
For more information Refer to the LabVIEW Help for more information about customizing VIs.
16-1
Chapter 16
Customizing VIs
different priorities. For example, if it is crucial that a VI runs without waiting for another operation to complete, configure the VI to run at time-critical (highest) priority. Refer to the Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability Application Note for more information about creating multithreaded VIs. Editor OptionsUse this page to set the size of the alignment grid for the current VI and to change the style of control or indicator LabVIEW creates when you right-click a terminal and select CreateControl or CreateIndicator from the shortcut menu. Refer to the Aligning and Distributing Objects section of Chapter 4, Building the Front Panel, for more information about the alignment grid.
Customizing Menus
You can create custom menus for every VI you build, and you can configure VIs to show or hide menu bars. Show and hide menu bars by selecting FileVI Properties, selecting Windows Appearance from the Category pull-down menu, clicking the Customize button, and placing or removing a checkmark from the Show Menu Bar checkbox. Configuring menus includes creating the menu and providing the block diagram code that executes when the user selects the various menu items.
Note
Creating Menus
You can build custom menus or modify the default LabVIEW menus statically when you edit the VI or programmatically when you run the VI. When you select EditRun-Time Menu and create a menu in the Menu Editor dialog box, LabVIEW creates a run-time menu (.rtm) file so you can have a custom menu bar on a VI rather than the default menu bar. After you create and save the .rtm file, you must maintain the same relative path between the VI and the .rtm file. Use the Menu Editor dialog box to associate a custom .rtm file with a VI. When the VI runs, it loads the menu from the .rtm file. You also can use the Menu Editor dialog box to build custom menus either with application items, which are menu items LabVIEW provides in the default menu, or with user items, which are menu items you add. LabVIEW defines the behavior of application items, but you control the behavior of user items with the block diagram. Refer to the Menu Selection Handling section of
16-2
ni.com
Chapter 16
Customizing VIs
this chapter for more information about handling user menu item selections. Use the Menu Editor dialog box to customize menus when editing a VI. Use the Menu functions to customize menus programmatically at run time. The functions allow you to insert, delete, and modify the attributes of user items. You can only add or delete application items because LabVIEW defines the behavior and state of application items.
16-3
Chapter 16
Customizing VIs
If you know that a certain menu item takes a long time to process, wire a Boolean control to the block menu input of the Get Menu Selection function and set the Boolean control to TRUE to disable the menu bar so the user cannot select anything else on the menu while LabVIEW processes the menu item. Wire a TRUE value to the Enable Menu Tracking function to enable the menu bar after LabVIEW processes the menu item. You also can use the Event structure to handle menu events. Refer to Chapter 9, Event-Driven Programming, for more information about the Event structure.
16-4
ni.com
17
You can access the VI Server through block diagrams, ActiveX technology, and the TCP protocol to communicate with VIs and other instances of LabVIEW so you can programmatically control VIs and LabVIEW. You can perform VI Server operations on a local computer or remotely across a network.
For more information Refer to the LabVIEW Help for more information about programmatically controlling VIs.
17-1
Chapter 17
Retrieve information about an instance of LabVIEW, such as the version number and edition. You also can retrieve environment information, such as the platform on which LabVIEW is running. Dynamically load VIs into memory when another VI needs to call them, rather than loading all subVIs when you open a VI. Create a plug-in architecture for the application to add functionality to the application after you distribute it to customers. For example, you might have a set of data filtering VIs, all of which take the same parameters. By designing the application to dynamically load these VIs from a plug-in directory, you can ship the application with a partial set of these VIs and make more filtering options available to users by placing the new filtering VIs in the plug-in directory.
17-2
ni.com
Chapter 17
Call By Reference NodeCalls a dynamically loaded VI. Close ReferenceCloses any open references to the VI, object, or application you accessed using the VI Server.
17-3
Chapter 17
Property Nodes
Use the Property Node to get and set various properties on an application or VI. Select properties from the node by using the Operating tool to click the property terminal or by right-clicking the white area of the node and selecting Properties from the shortcut menu. You can read or write multiple properties using a single node, however some properties are not writable. Use the Positioning tool to resize the Property Node to add new terminals. A small direction arrow to the right of the property indicates a property you read. A small direction arrow to the left of the property indicates a property you write. Right-click the property and select Change to Read or Change to Write from the shortcut menu to change the operation of the property. The node executes from top to bottom. The Property Node does not execute if an error occurs before it executes, so always check for the possibility of errors. If an error occurs in a property, LabVIEW ignores the remaining properties and returns an error. The error out cluster contains information about which property caused the error. If the Property Node opens and returns a reference to an application or VI, use the Close Reference function to close the application or VI reference. LabVIEW closes control references when that reference is no longer needed. You do not have to explicitly close control references.
Invoke Nodes
Use the Invoke Node to perform actions, or methods, on an application or VI. Unlike the Property Node, a single Invoke Node executes only a single method on an application or VI. Select a method by using the Operating tool to click the method terminal or by right-clicking the white area of the node and selecting Methods from the shortcut menu.
17-4
ni.com
Chapter 17
The name of the method is always the first terminal in the list of parameters in the Invoke Node. If the method returns a value, the method terminal displays the return value. Otherwise, the method terminal has no value. The Invoke Node lists the parameters from top to bottom with the name of the method at the top and the optional parameters, which are dimmed, at the bottom.
If you do not wire a refnum to the reference input, the Property Node or Invoke Node uses a reference to the current instance of LabVIEW. If you want to manipulate the properties or methods of another instance of LabVIEW, you must wire an application refnum to the reference input. To find the VIs in memory on a remote computer, wire a string control to the machine name input of the Open Application Reference function, as shown in Figure 17-2, and enter the IP address or domain name. You also must select the Exported VIs in Memory property because the All VIs in Memory property used in Figure 17-1 applies only to local instances of LabVIEW.
17-5
Chapter 17
The Property Node operates similarly to the Invoke Node. After you wire a VI refnum to the Property Node, you can access all the VI Class properties.
17-6
ni.com
Chapter 17
17-7
Chapter 17
The VI you specify for strictly typed refnums provides only the connector pane information. That is, no permanent association is made between the refnum and the VI. In particular, avoid confusing selecting the VI connector pane with getting a refnum to the selected VI. You specify a particular VI using the vi path input on the Open VI Reference function.
17-8
ni.com
Chapter 17
reference to a subVI, use Property Nodes and Invoke Nodes to read and write properties and invoke methods of the referenced front panel object. Refer to the Case and Sequence Structures section of Chapter 8, Loops and Structures, for information about using events to control block diagram behavior programmatically through front panel objects.
Because the latch mechanical actions are incompatible with strictly typed control references, Boolean controls with latch mechanical action produce weakly typed control references. Weakly typed control references are more flexible in the type of data they accept. For example, if the type of a weakly typed control reference is slide, you can wire a 32-bit integer slide, single-precision slide, or a cluster of 32-bit integer slides to the control reference terminal. If the type of a weakly typed control reference is control, you can wire a control reference of any type of control to the control reference terminal.
Note
When you wire a Property Node to a weakly typed control reference terminal, the Value property produces variant data, which might require conversion before you can use the data. The History Data property for charts is available only if the chart reference is strictly typed. Refer to the Handling Variant Data section of Chapter 5, Building the Block Diagram, for more information about variant data.
17-9
Networking in LabVIEW
18
VIs can communicate, or network, with other processes, including those that run on other applications or on remote computers. Use the networking features in LabVIEW to perform the following tasks: Share live data with other VIs running on a network using National Instruments DataSocket technology. Publish front panel images and VI documentation on the Web. Email data from VIs. Build VIs that communicate with other applications and VIs through low-level protocols, such as TCP, UDP, Apple events, and PPC Toolbox.
For more information Refer to the LabVIEW Help for more information about networking in LabVIEW.
applications, such as embedding a waveform graph in an Excel spreadsheet, use the ActiveX VIs and functions. Refer to Chapter 19, Windows Connectivity, for more information about accessing ActiveX-enabled applications and permitting other ActiveX applications access to LabVIEW.
18-1
Chapter 18
Networking in LabVIEW
information about using ActiveX technology with LabVIEW as an ActiveX server or client.
18-2
ni.com
Chapter 18
Networking in LabVIEW
For example, if you want to share the data in a thermometer indicator on the front panel with other computers on the Web, publish the thermometer data by specifying a URL in the DataSocket Connection dialog box. Users on other computers subscribe to the data by placing a thermometer on their front panel and selecting the URL in the DataSocket Connection dialog box. Refer to the Using DataSocket on the Front Panel section of this chapter for more information about using DataSocket technology on the front panel. Refer to the Integrating the Internet into Your Measurement System white paper for more information about DataSocket technology. This white paper is available as a PDF from the Installation CD, in the manuals directory, or from the National Instruments Web site at ni.com.
Specifying a URL
URLs use communication protocols, such as dstp, ftp, and file, to transfer data. The protocol you use in a URL depends on the type of data you want to publish and how you configure your network. You can use the following protocols when you publish or subscribe to data using DataSocket: DataSocket Transport Protocol (dstp)The native protocol for DataSocket connections. When you use this protocol, the VI communicates with the DataSocket Server. You must provide a named tag for the data, which is appended to the URL. The DataSocket connection uses the named tag to address a particular data item on a DataSocket Server. To use this protocol, you must run a DataSocket Server.
(Windows) OLE for Process Control (opc)Designed specifically
for sharing real-time production data, such as data generated by industrial automation operations. To use this protocol, you must run an OPC server.
(Windows) logosAn internal National Instruments technology for transmitting data between the network and your local computer.
File Transfer Protocol (ftp)You can use this protocol to specify a file from which to read data.
Note To read a text file from an FTP site using DataSocket, add [text] to the end of the DataSocket URL.
fileYou can use this protocol to provide a link to a local or network file that contains data.
18-3
Chapter 18
Networking in LabVIEW
URL
dstp
Example
dstp://servername.com/numeric, where numeric is
Use the dstp, opc, and logos URLs to share live data because these protocols can update remote and local controls and indicators. Use the ftp and file URLs to read data from files because these protocols cannot update remote and local controls and indicators. Refer to the examples\comm\datasktx.llb for examples of using DataSocket connections.
Variant dataUse variant data to subscribe to data from another application, such as a National Instruments Measurement Studio ActiveX control.
18-4
ni.com
Chapter 18
Networking in LabVIEW
18-5
Chapter 18
Networking in LabVIEW
value of your front panel control, your VI publishes the value to the front panels of other users. The front panel objects that subscribe to data do not have to be the same kind of objects that publish the data. However, the front panel objects must be the same data type or, if they are numeric data, they must coerce. For example, you can use a digital indicator in your VI to view the data a thermometer in another VI generates. The thermometer can be a floating-point number, and the digital indicator can be an integer. Front panel DataSocket connections are primarily intended for sharing live data. To read data in local files, FTP servers, or Web servers, use the DataSocket Read function, the File I/O VIs and functions, or the Application Control VIs and functions.
The DataSocket Write function is polymorphic, so you can wire most data types to the data input. Refer to the Polymorphic VIs and Functions section of Chapter 5, Building the Block Diagram, for more information about polymorphic VIs and functions. Use the DataSocket Read function to read live data from a DataSocket connection programmatically. Figure 18-2 shows how to read data and convert it to a double-precision floating-point number.
18-6
ni.com
Chapter 18
Networking in LabVIEW
Convert live data to a specific data type by wiring a control or constant to the type input of DataSocket Read. If you do not specify a type, the data output of DataSocket Read returns variant data, which you must manipulate with the Variant to Data function.
Client-side buffering also applies to other protocols, such as opc, logos, and file. To use dstp buffering, you also must use the DataSocket Server Manager to configure server-side buffering. Refer to the DataSocket Help for more information about server-side buffering.
18-7
Chapter 18
Networking in LabVIEW
dstp buffering does not guarantee data delivery. If the data in a buffer at
the server or client exceeds the buffer size, the buffer discards older values in place of newer values. To detect discarded values in a data stream, wire the published data to the Set Variant Attribute function to uniquely identify each value in the publisher and check for discarded sequence IDs in the subscriber. Set the mode input of the DataSocket Open function to BufferedRead or BufferedReadWrite and use a Property Node to set the DataSocket properties for the size of a FIFO buffer. Doing so ensures that LabVIEW stores the values the client receives in a buffer rather than overwriting them every time the value changes.
Note
If you use DataSocket properties to set the size of a FIFO buffer, you must set the mode input of the DataSocket Open function to BufferedRead or BufferedReadWrite. Otherwise, the item at the server is not buffered for the connection. Figure 18-3 uses DataSocket buffering.
Buffering applies only when you use the DataSocket Read function to subscribe to data a server publishes. Buffering is not available when you use front panel DataSocket connections to subscribe to data.
Reporting Diagnostics
Use the Buffer Utilization (Bytes) property or the Buffer Utilization (Packets) property to request diagnostic information about the buffers you specify. Use these properties to check the percentage of buffer in use on the client to determine whether the current buffer size is sufficient. If the value
18-8
ni.com
Chapter 18
Networking in LabVIEW
of either of these properties approaches the maximum value of the buffer, increase the buffer size to make sure you receive all values the server publishes. Refer to the LabVIEW Help for more information about specifying the buffer size for a DataSocket client.
When another VI reads the live data, the VI must convert the variant data to a data type it can manipulate. Figure 18-5 shows a block diagram that continually reads temperature data from a DataSocket connection, converts the variant data into a temperature reading, retrieves the time stamp attribute associated with each reading, and displays the temperature and the time stamp on the front panel.
18-9
Chapter 18
Networking in LabVIEW
Use the LabVIEW Enterprise Connectivity Toolset to control VIs on the Web and to add more security features to VIs you publish on the Web. Refer to the National Instruments Web site at ni.com for more information about this toolset.
You must enable the Web Server in the Web Server: Configuration page of the Options dialog box before you can publish VIs on the Web. You also can enable the Web Server with the Web Publishing Tool, described in the Creating HTML Documents section of this chapter. The VIs must be in memory before you publish them.
18-10
ni.com
Chapter 18
Networking in LabVIEW
18-11
Chapter 18
Networking in LabVIEW
Use the LabVIEW Web Server if you want to control entire VIs. Use the DataSocket Server to read and write data on a single front panel control in a VI. Refer to the Using DataSocket Technology section of this chapter for more information about using the DataSocket Server.
18-12
ni.com
Chapter 18
Networking in LabVIEW
Note (Windows 9.x) The LabVIEW Full Development System and the Application Builder include a remote panel license that allows one client to view and control a front panel remotely. The LabVIEW Professional Development System includes a remote panel license that allows five clients to view and control a front panel remotely. You cannot upgrade the remote panel license to support more clients on Windows 9x. (Windows 2000/NT/XP, Mac OS, and UNIX) The LabVIEW Full Development System and the Application Builder include a remote panel license that allows one client to view and control a front panel remotely. The LabVIEW Professional Development System includes a remote panel license that allows five clients to view and control a front panel remotely. You can upgrade the remote panel license to support more clients.
Before you can view and control a front panel remotely, you must enable the Web Server on the server computer where the VI you want to view and control is located.
18-13
Chapter 18
Networking in LabVIEW
All VIs you want clients to view and control must be in memory. If the requested VI is in memory, the server sends the front panel of the VI to the requesting client. If the VI is not in memory, the Connection Status section of the Open Remote Panel dialog box displays an error message.
18-14
ni.com
Chapter 18
Networking in LabVIEW
18-15
Chapter 18
Networking in LabVIEW
The SMTP E-mail VIs are available only in the Full and Professional Development Systems. In addition to the recipient(s) email address, you must know the Web address of the SMTP server. You specify a mail server by wiring a mail server to every SMTP E-mail VI you use. The mail server must be the host name or IP address of an external server computer that can service requests from the computer running the SMTP E-mail VIs. If you do not know which mail server to use, contact your network administrator for the name of a valid server. After you specify a valid mail server, the SMTP E-mail VIs open a connection to the server and send the server commands that describe the recipients and the contents of the email. The server sends the message to the individual recipients or forwards it to other SMTP servers. Refer to the examples\comm\smtpex.llb for examples of using the SMTP E-mail VIs.
Note
The SMTP E-mail VIs do not support multi-byte characters, such as Japanese.
18-16
ni.com
Chapter 18
Networking in LabVIEW
A character code is a number that represents a character. Because computers interpret only numbers, they must associate a character with a number to operate on the character. A character set is the relationship between characters and the numbers that represent them in the computer. For example, in the ASCII character set, the character codes for A, B, and C, are 65, 66, and 67, respectively.
18-17
Chapter 18
Networking in LabVIEW
receives text designated as using the ISO Latin-1 character set, it converts the text to the Mac OS character set.
Transliteration
Transliteration is the mapping of characters to another character set. Use transliteration if you are sending an email and you need to change the text of the email to the corresponding characters in another character set. You can use the SMTP E-mail VIs to specify character sets that map text to another character set before sending the text. For example, if you create a message using standard ASCII characters and specify that the character set is MacRoman, the SMTP E-mail VIs transliterate the text and send it as character set iso-8859-1 (ISO Latin-1). Use the translit input parameter of the SMTP E-mail VIs to specify which transliterations the VIs can use. A transliteration is defined by a virtual character set, a target character set, and a transliteration, or mapping, file. The transliteration file specifies that one character maps to another character. The transliteration file is a binary file of 256 bytes with 256 entries. Each entry in the file corresponds to a character in the virtual character set, and contains the new character code from the target character set. For example, if you want to map the a character, whose code is 61, to the A character, whose code is 41, the entry with an index of 61 in the transliteration file should contain the value 41. If an entry contains a value that equals its index, the transliteration file does not modify the character in the virtual character set. For example, if the entry with an index of 61 in the transliteration file contains a value of 61, the transliteration file does not modify the character. When you specify a transliteration file as the target character set in the translit input, the mappings are applied in the order specified. For example, if the transliteration entry is [MacRoman iso-8859-1 macroman.trl, MacRomanUp MacRoman asciiup.trl], the character set MacRoman changed to iso-8859-1 using macroman.trl and then MacRomanUp changed to MacRoman using asciiup.trl. Refer to the vi.lib\ Utility\SMTP directory for examples of .trl files.
18-18
ni.com
Chapter 18
Networking in LabVIEW
18-19
Chapter 18
Networking in LabVIEW
18-20
ni.com
Windows Connectivity
19
LabVIEW provides access to other Windows applications using .NET or ActiveX technologies. You can use LabVIEW as a .NET client to access the objects, properties, and methods associated with .NET servers. LabVIEW is not a .NET server. Other applications cannot directly communicate with LabVIEW through .NET. With a .NET-enabled VI, you can connect to Windows services and APIs. The .NET framework includes COM+ component services, ASP Web development framework, and support for Web service protocols, such as, SOAP, WSDL, and UDDI. The .NET framework is the programming basis of the .NET environment you use to build, deploy, and run Web-based applications, smart client applications, and XML Web services. With ActiveX Automation, a Windows application, such as LabVIEW, provides a public set of objects, commands, and functions that other Windows applications can access. You can use LabVIEW as an ActiveX client to access the objects, properties, methods, and events associated with other ActiveX-enabled applications. LabVIEW also can act as an ActiveX server, so other applications can access LabVIEW objects, properties, and methods. .NET refers to Microsofts .NET technology. You must install the .NET framework. Refer to the MSDN Web site for more information about .NET and installing the framework. ActiveX refers to Microsofts ActiveX technology and OLE technology. Refer to the Microsoft Developers Network documentation, Inside OLE, by Kraig Brockschmidt, second edition, and Essential COM, by Don Box, for more information about ActiveX.
For more information Refer to the LabVIEW Help and the National Instruments Web site at ni.com for more information about using .NET and ActiveX technology.
19-1
Chapter 19
Windows Connectivity
.NET Environment
The following list provides a background of the various elements that make up the .NET environment. The purpose of this information is to help you understand .NET, but learning this information is not essential for you to use the .NET components in LabVIEW. Common Language Runtime (CLR)a set of libraries responsible for run-time services, such as language integration, security enforcement, memory, garbage collection, process management, and thread management. The CLR forms the foundation of .NET and uses the intermediate language (IL) that all programming languages generate to facilitate communication between .NET and other programs. To help .NET communicate with various programs, the CLR provides a data type system that spans programming languages and operating system boundaries. Developers use CLR to view the system as a collection of data types and objects rather than as a collection of memory and threads. The CLR requires compilers and linkers to generate information in the CLR IL metadata format. In a Win32 system, all programming language compilers generate CLR IL code rather than the assembly code. Class Librariesa set of classes that provides standard functionality, such as input and output, string manipulation, security management, network communications, thread management, text management, user interface design features, and so on. These classes contain the same functions the Win32/COM system uses. In the .NET framework, you can use classes created in one .NET language in another .NET language. Assembliesa unit of deployment similar to a DLL, OCX, or executable for a component in COM. Assemblies are DLLs and executables you build using the .NET CLR. Assemblies can consist of a single file or multiple files. An assembly includes a manifest that contains information about the assembly name, version information, local information, publisher's security information, list of files that make up the assembly, list of dependent assemblies, resources, and exported data types. Single-file assemblies contain all the data in a single file, including the manifest and any resources it needs. Multi-file assemblies might have external resources, such as bitmaps, icons, sound files, and so on, or have one file for the core code and another for helper libraries.
19-2
ni.com
Chapter 19
Windows Connectivity
Assemblies can be public or private. .NET requires that private assemblies be in the same directory as the application directory and that public assemblies be in a system wide global cache called the Global Assembly Cache (GAC). The developer of the application typically writes private assemblies for use by that application. The developer of the assembly also decides the version control. The assembly name is the filename, minus any file extension, of the file that contains the manifest. Global Assembly Cache (GAC)a listing of the public assemblies available on the system. The GAC is similar to the registry COM uses.
19-3
Chapter 19
Windows Connectivity
To access a .NET object, use the Constructor Node on the block diagram to create the required .NET object. Use the Constructor Node to select a class of object from an assembly. When you place a Constructor Node on the block diagram, LabVIEW displays the Select .NET Constructor dialog box, which lists all public assemblies in the GAC. If you want to select a private assembly, click the Browse button in the dialog box and navigate the file system for a private assembly. .NET assemblies are .dll and .exe file types. After you select a private assembly, the assembly appears in the Assembly pull-down menu in the Select .NET Constructor dialog box the next time you launch this dialog box. When you select an assembly and class, the constructors for that class appear in the Constructors section of the Select .NET Constructor dialog box. Select the constructor and click the OK button to close this dialog box. LabVIEW displays the name of the class you selected on the Constructor Node. The Constructor Node is similar to the Automation Open function for ActiveX, except that a Constructor Node can specify initialization parameters for creating the object. You can wire the .NET server reference from the Constructor Node to a Property Node or Invoke Node and select a property or method from the shortcut menu. Use the Close Reference function to close the reference to the .NET object. Refer to the LabVIEW Help for more information about creating .NET objects.
19-4
ni.com
Chapter 19
Windows Connectivity
.NET Types System.Int32, System.UInt32, System.Int16, System.UInt16 System.String System.Boolean System.Byte, System.Char, System.UByte System.Single, System.Double, System.Decimal System.Array Enumeration DateTime Any other .NET object , , ,
LabVIEW Types , ,
, ,
Deploying an Executable
When you build applications that use .NET objects, you must copy the private assemblies the VIs use into the directory of the stand-alone application and make sure that the target computer has the .NET framework installed.
19-5
Chapter 19
Windows Connectivity
Deploying VIs
When you deploy the VIs, you must copy the private assemblies the VIs use to the directory of the top-level VI. Make sure all assemblies the VIs use are in the same directory structure of the top-level VI and make sure that the target computer has the .NET framework installed.
Deploying DLLs
When you deploy a LabVIEW-built DLL, you must copy the private assemblies the VIs use to the directory of the application that uses the LabVIEW-built DLL and make sure that the target computer has the .NET framework installed.
19-6
ni.com
Chapter 19
Windows Connectivity
LabVIEW accesses an ActiveX object with the automation refnum control or the ActiveX container, both of which are front panel objects. Use the automation refnum control to select an ActiveX object. Use the ActiveX container to select a displayable ActiveX object, such as a button or
19-7
Chapter 19
Windows Connectivity
document and place it on the front panel. Both objects appear as automation refnum controls on the block diagram.
Applications that include ActiveX custom interfaces appear with a icon. Click the icon to select an object for the custom interface. Refer to the Support for Custom ActiveX Automation Interfaces section of this chapter for more information about custom interfaces.
19-8
ni.com
Chapter 19
Windows Connectivity
If you use the ActiveX container, you do not have to have to wire the automation refnum control on the block diagram to the Automation Open function or close the reference to the object using the Close Reference function. You can wire directly to the Invoke Node or Property Node because the ActiveX container embeds the calling application in LabVIEW. However, if the ActiveX container includes properties or methods that return other automation refnum references, you must close these additional references.
19-9
Chapter 19
Windows Connectivity
Like the ActiveX Property Browser, ActiveX property pages are an easy way to set the properties of an ActiveX object interactively, but you cannot use them to set properties programmatically, and you can use property pages only with ActiveX objects in a container. Property pages are not available for all ActiveX objects. Property pages also are not available in Run mode or when the VI is running.
Property Nodes
Use the Property Node to set ActiveX properties programmatically. For example, if you use an ActiveX object to warn a user when a temperature exceeds a limit, use the Property Node to set the Value property of the object to specify the limit. The following example changes the Value property of the CWButton ActiveX control, which is part of the National Instruments Measurement Studio User Interface ActiveX Library, when the temperature reaches 85 degrees Fahrenheit or higher.
In this case, the CWButton control acts as an LED, changes colors, and displays Warning when the temperature reaches the limit, which is the on state of the CWButton control.
Note
In this example, you could use the ActiveX Property Browser or property pages to set the OffText, OffColor, OnText, and OnColor properties for the CWButton control because you do not need to set those properties programmatically. Refer to the ActiveX Property Browser and ActiveX Property Pages sections in this chapter for more information about the ActiveX Property Browser and property pages, respectively.
19-10
ni.com
Chapter 19
Windows Connectivity
19-11
Chapter 19
Windows Connectivity
Parameters that accept data values have a small arrow to the left of the parameter name. To view the corresponding numeric data value, right-click the ring constant and select Visible ItemsDigital Display from the shortcut menu. The VIs in Figures 19-1 and 19-2 both access the Microsoft Excel application and execute a method. The Index parameter of the ActivateMicrosoftApp method has the following options: MicrosoftWord, MicrosoftPowerPoint, MicrosoftMail, MicrosoftAccess, MicrosoftFoxPro, MicrosoftProject, and MicrosoftSchedulePlus. To identify the numeric value of the Index parameter that corresponds to the MicrosoftAccess option in Figure 19-1, select the MicrosoftAccess option from the pull-down menu in the ring constant. The numeric value of the currently selected option appears in a box next to the ring constant. Instead of using a ring constant, you can enter the numeric value of an option into a numeric constant, as shown in Figure 19-2.
ActiveX Events
To use ActiveX events in an application, you must register for the event and handle the event when it occurs. ActiveX event registration is similar to dynamic event registration as explained in the Dynamic Event Registration section of Chapter 9, Event-Driven Programming. However, the architecture of an ActiveX event VI is different than the architecture of an
19-12
ni.com
Chapter 19
Windows Connectivity
event-handling VI as described in Chapter 9, Event-Driven Programming. The following components make up a typical ActiveX event VI: ActiveX object for which you want to generate an event. Register Event Callback node to specify and register for the type of event you want to generate. Callback VI that contains the code you write to handle the event you specify.
You can generate and handle events on ActiveX objects in a container or on ActiveX objects you specify by using an Automation Refnum. For example, you can call a Windows tree control from an ActiveX container and specify that you want to generate a Double Click event for the items displayed in the tree control. The Register Event Callback node is a growable node capable of handling multiple events, similar to the Register For Events node. When you wire an ActiveX object reference to the Register Event Callback node and specify the event you want to generate for that object, you are registering the ActiveX object for that event. After you register for the event, you create a callback VI that contains the code you write to handle the event.
19-13
Chapter 19
Windows Connectivity
CtlRef is a reference to the ActiveX or Automation Refnum on which the event occurred. Event Data is a cluster of the parameters specific to the event the callback VI handles. LabVIEW determines the appropriate Event Data when you select an event from the Register Event Callback node. Refer to the Notify and Filter Events section of Chapter 9, Event-Driven Programming, for more information about notify and filter events. Event Data Out is a cluster of the modifiable parameters specific to the event the callback VI handles. This element is available only for filter events. (Optional) User Parameter is data LabVIEW passes to the user through the callback VI when the ActiveX object generates the event.
Note You can use an existing VI as a callback VI as long as the connector pane of the VI you intend to use matches the connector pane of the event data. National Instruments recommends that the callback VI be reentrant because if it is not, LabVIEW cannot call it simultaneously if ActiveX events occur multiple times.
19-14
ni.com
20
You can call most standard shared libraries in LabVIEW using the Call Library Function Node. You also can call C code in LabVIEW using the Code Interface Node (CIN). Refer to the Call Library Function Nodes and Code Interface Nodes section of Chapter 6, LabVIEW Style Guide, in the LabVIEW Development Guidelines manual for more information about platform-specific considerations when calling external code. Refer to the Using External Code in LabVIEW manual for more information about calling code from text-based programming languages.
For more information Refer to the LabVIEW Help for more information about calling code from text-based programming languages.
20-1
21
When you want to use a complicated equation in LabVIEW, you do not have to wire together various arithmetic functions on the block diagram. You can develop equations in a familiar, mathematical environment and then integrate the equations into an application. Use the Formula Node and Expression Node to perform mathematical operations in the LabVIEW environment. For more additional functionality, you can link to the mathematics application MATLAB.
For more information Refer to the LabVIEW Help for more information about using equations and the syntax to use, available functions and operators, and descriptions of possible errors.
Formula Nodes
The Formula Node is a convenient text-based node you can use to perform mathematical operations on the block diagram. You do not have to access any external code or applications, and you do not have to wire low-level arithmetic functions to create equations. In addition to text-based equation expressions, the Formula Node can accept text-based versions of if statements, while loops, for loops, and do loops, which are familiar to
21-1
Chapter 21
C programmers. These programming elements are similar to what you find in C programming but are not identical. Formula Nodes are useful for equations that have many variables or are otherwise complicated and for using existing text-based code. You can copy and paste the existing text-based code into a Formula Node rather than recreating it graphically. Formula Nodes use type checking to make sure that array indexes are numeric data and that operands to the bit operations are integer data. Formula Nodes also check to make sure array indexes are in range. For arrays, an out-of-range value defaults to zero, and an out-of-range assignment defaults to nop to indicate no operation occurs. Formula Nodes also perform automatic type conversion.
Refer to the Equations VI in the examples\general\structs.llb for an example of using a Formula Node.
21-2
ni.com
Chapter 21
Expression Nodes
Use Expression Nodes to calculate expressions, or equations, that contain a single variable. Expression Nodes are useful when an equation has only one variable, but is otherwise complicated. Expression Nodes use the value you pass to the input terminal as the value of the variable. The output terminal returns the value of the calculation. For example, consider this simple equation: x x + 33 ( x + 5 )
21-3
Chapter 21
The block diagram in the following figure uses Numeric functions to represent this equation.
Use an Expression Node, as shown in the following figure, to create a much simpler block diagram.
21-4
ni.com
Chapter 21
If you do not already have a script written, you can place a script node on the block diagram and create a script using MATLAB syntax. LabVIEW communicates with the script server engine, which is a program that runs the script. LabVIEW communicates and controls the script server engine using an industry-established protocol. A script server engine is installed with MATLAB. Because of the nature of the MATLAB script language, the script node cannot determine the data type of terminals you created. You must assign a LabVIEW data type to each script node terminal.Table 21-1 shows LabVIEW data types and the corresponding data types in MATLAB.
Table 21-1. LabVIEW and MATLAB Data Types
String String Real Vector Real Matrix Complex Complex Vector Complex Matrix Use the Conversion functions or the String/Array/Path Conversion functions to convert a LabVIEW data type to a data type that MATLAB supports.
21-5
Chapter 21
Create controls and indicators for the inputs and outputs to monitor the values the script node passes between LabVIEW and MATLAB. This allows you to pinpoint where a script node calculates a value incorrectly, if necessary. Take advantage of the error-checking parameters for debugging information. Create an indicator for the error out terminal on a script node so you can view error information at run time. Formula Nodes also show errors at compile time.
21-6
ni.com
Organization of LabVIEW
This appendix describes the structure of the LabVIEW file system and the suggested locations for saving files.
Libraries
create. LabVIEW displays controls on User Controls palettes and VIs on User Libraries palettes. This directory does not change if you upgrade or uninstall LabVIEW. Refer to the Adding VIs and Controls to the User and Instrument Drivers Subpalettes section of Chapter 3, LabVIEW Environment, for more information about saving files in the user.lib directory.
vi.libContains libraries of built-in VIs, which LabVIEW displays in related groups on the Functions palette. Do not save files in the vi.lib directory because LabVIEW overwrites these files when you upgrade or reinstall. instr.libContains instrument drivers used to control PXI, VXI, GPIB, serial, and computer-based instruments. When you install National Instruments instrument drivers and place them in this directory, LabVIEW adds them to the Instrument Drivers palette.
A-1
Appendix A
Organization of LabVIEW
application. Do not save files into this directory because LabVIEW overwrites these files when you upgrade or reinstall.
projectContains files that become items on the LabVIEW Tools
menu.
templatesContains templates for common VIs. wwwLocation of HTML files you can access through the Web Server.
Documentation
manualsContains documentation in PDF format. This folder does not contain the help files. Access the PDFs by selecting HelpSearch the LabVIEW Bookshelf. helpContains the help files. Access the LabVIEW Help by selecting
Mac OS
In addition to the above directories, Mac users have a shared libraries folder that contains support files for the LabVIEW application.
Controls or User Libraries palettes. Refer to the Adding VIs and Controls to the User and Instrument Drivers Subpalettes section of Chapter 3, LabVIEW Environment, for more information about saving files in the user.lib directory.
A-2
ni.com
Appendix A
Organization of LabVIEW
Note
Save subVIs in the user.lib directory only if they are portable, without modification, across projects. Paths to VIs in user.lib are relative to the labview directory. Paths to subVIs you save elsewhere are relative to the parent VI. Therefore, copying a VI from user.lib to modify it for a special case does not change the path to its subVIs located in user.lib.
instr.libAny instrument driver VI you want to display on the Instrument Drivers palette. projectVIs you use to extend LabVIEW capabilities. VIs you
or .txt files. You also can create a directory anywhere on your hard drive to store LabVIEW files that you create. Refer to the Saving VIs section of Chapter 7, Creating VIs and SubVIs, for more information about creating directories.
A-3
Polymorphic Functions
Functions are polymorphic to varying degreesnone, some, or all of their inputs can be polymorphic. Some function inputs accept numerics or Boolean values. Some accept numerics or strings. Some accept not only scalar numerics but also arrays of numerics, clusters of numerics, arrays of clusters of numerics, and so on. Some accept only one-dimensional arrays although the array elements can be of any type. Some functions accept all types of data, including complex numerics. Refer to the Polymorphic Units in LabVIEW Application Note for more information about creating and using polymorphic units.
For more information Refer to the LabVIEW Help for more information about polymorphic functions.
Numeric Conversion
You can convert any numeric representation to any other numeric representation. When you wire two or more numeric inputs of different representations to a function, the function usually returns output in the larger or wider format. The functions coerce the smaller representations to the widest representation before execution and LabVIEW places a coercion dot on the terminal where the conversion takes place. Some functions, such as Divide, Sine, and Cosine, always produce floating-point output. If you wire integers to their inputs, these functions convert the integers to double-precision, floating-point numbers before performing the calculation. For floating-point, scalar quantities, it is usually best to use double-precision, floating-point numbers. Single-precision, floating-point numbers save little or no run time and overflow much more easily. The analysis libraries, for example, use double-precision, floating-point numbers. You should only use extended-precision, floating-point numbers when necessary. The performance and precision of extended-precision arithmetic varies among the platforms. Refer to the Undefined or
B-1
Appendix B
Polymorphic Functions
Unexpected Data section of Chapter 6, Running and Debugging VIs, for more information about floating-point overflow. For integers, it is usually best to use a 32-bit signed integer. If you wire an output to a destination that has a different numeric representation, LabVIEW converts the data according to the following rules: Signed or unsigned integer to floating-point numberConversion is exact, except for 32-bit integers to single-precision, floating-point numbers. In this case, LabVIEW reduces the precision from 32 bits to 24 bits. Floating-point number to signed or unsigned integerLabVIEW moves out-of-range values to the integers minimum or maximum value. Most integer objects, such as the iteration terminal of a For Loop, round floating-point numbers. LabVIEW rounds a fractional part of 0.5 to the nearest even integer. For example, LabVIEW rounds 6.5 to 6 rather than 7. Integer to integerLabVIEW does not move out-of-range values to the integers minimum or maximum value. If the source is smaller than the destination, LabVIEW extends the sign of a signed source and places zeros in the extra bits of an unsigned source. If the source is larger than the destination, LabVIEW copies only the least significant bits of the value.
B-2
ni.com
Appendix B
Polymorphic Functions
Arrays can have any number of dimensions of any size. Clusters can have any number of elements. The output type of functions is of the same numeric representation as the input type. For functions with one input, the functions operate on each element of the array or cluster. For functions with two inputs, you can use the following input combinations: SimilarBoth inputs have the same structure, and the output has the same structure as the inputs. One scalarOne input is a numeric scalar, the other is an array or cluster, and the output is an array or cluster. Array ofOne input is a numeric array, the other is the numeric type itself, and the output is an array.
For similar inputs, LabVIEW performs the function on the respective elements of the structures. For example, LabVIEW can add two arrays element by element. Both arrays must have the same dimensionality. You can add arrays with differing numbers of elements; the output of such an addition has the same number of elements as the smallest input. Clusters must have the same number of elements, and the respective elements must be of the same type. You cannot use the Multiply function to do matrix multiplication. If you use the Multiply function with two matrices, LabVIEW takes the first number in the first row of the first matrix, multiplies it by the first number in the first row of the second matrix, and so on. For operations involving a scalar and an array or cluster, LabVIEW performs the function on the scalar and the respective elements of the structure. For example, LabVIEW can subtract a number from all elements of an array, regardless of the dimensionality of the array. For operations that involve a numeric type and an array of that type, LabVIEW performs the function on each array element. For example, a graph is an array of points, and a point is a cluster of two numeric types, x and y. To offset a graph by 5 units in the x direction and 8 units in the y direction, you can add a point, (5, 8), to the graph.
B-3
Appendix B
Polymorphic Functions
Figure B-1 shows the possible polymorphic combinations of the Add function.
Similar Scalar Scalar Scalar Scalar Array Array Array Array Scalar Cluster Cluster Cluster Cluster Array of Array of Clusters Cluster Array of Clusters Cluster Array One Scalar
Appendix B
Polymorphic Functions
Similar Boolean Scalar Boolean Scalar Boolean Array Boolean Array Cluster Cluster Boolean Scalar Boolean Array Boolean Scalar Boolean Cluster Cluster
One Scalar
B-5
Appendix B
Polymorphic Functions
Exponential/Fract/Sci accept clusters and arrays of strings and produce clusters and arrays of numbers. Width and precision inputs must be scalar.
B-6
ni.com
Appendix B
Polymorphic Functions
You can use the Equal?, Not Equal?, Not A Number/Path/Refnum?, Empty String/Path?, and Select functions with paths and refnums, but no other Comparison functions accept paths or refnums as inputs. Comparison functions that accept arrays and clusters normally return Boolean arrays and clusters of the same structure. If you want the function to return a single Boolean value, right-click the function and select Comparison ModeCompare Aggregates from the shortcut menu. Refer to the Comparing Arrays and Clusters section of Appendix C, Comparison Functions, for more information about how the function compares aggregates.
B-7
Comparison Functions
Use the Comparison functions to compare Boolean values, strings, numerics, arrays, and clusters. Most Comparison functions test one input or compare two inputs and return a Boolean value.
For more information Refer to the LabVIEW Help for more information about Comparison functions.
Comparing Strings
LabVIEW compares strings based on the numerical equivalent of the ASCII characters. For example, a (with a decimal value of 97) is greater than A (65), which is greater than the numeral 0 (48), which is greater than the space character (32). LabVIEW compares characters one by one from the beginning of the string until an inequality occurs, at which time the comparison ends. For example, LabVIEW evaluates the strings abcd and abef until it finds c, which is less than the value of e. The presence of a character is greater than the absence of one. Thus, the string abcd is greater than abc because the first string is longer. The functions that test the category of a string character, such as the Decimal Digit? and Printable? functions, evaluate only the first character of the string.
C-1
Appendix C
Comparison Functions
Comparing Numerics
The Comparison functions convert numeric values to the same representation before comparing them. Comparisons with one or two inputs having the value Not a Number (NaN) return a value that indicates inequality. Refer to the Undefined or Unexpected Data section of Chapter 6, Running and Debugging VIs, for more information about the NaN value.
Arrays
When comparing multidimensional arrays, each array wired to the function must have the same number of dimensions. The Comparison functions that operate only in Compare Aggregates mode compare arrays the same way they compare stringsone element at a time starting with the first element until they encounter an inequality.
C-2
ni.com
Appendix C
Comparison Functions
Clusters
Clusters you compare must include the same number of elements, each element in the clusters must be of compatible types, and the elements must be in the same cluster order. For example, you can compare a cluster of a DBL and a string to a cluster of an I32 and a string.
C-3
Visit the following sections of the National Instruments Web site at ni.com for technical support and professional services: SupportOnline technical support resources include the following: Self-Help ResourcesFor immediate answers and solutions, visit our extensive library of technical support resources available in English, Japanese, and Spanish at ni.com/support. These resources are available for most products at no cost to registered users and include software drivers and updates, a KnowledgeBase, product manuals, step-by-step troubleshooting wizards, conformity documentation, example code, tutorials and application notes, instrument drivers, discussion forums, a measurement glossary, and so on. Assisted Support OptionsContact NI engineers and other measurement and automation professionals by visiting ni.com/support. Our online system helps you define your question and connects you to the experts by phone, discussion forum, or email.
TrainingVisit ni.com/custed for self-paced tutorials, videos, and interactive CDs. You also can register for instructor-led, hands-on courses at locations around the world. System IntegrationIf you have time constraints, limited in-house technical resources, or other project challenges, NI Alliance Program members can help. To learn more, call your local NI office or visit ni.com/alliance.
If you searched ni.com and could not find the answers you need, contact your local office or NI corporate headquarters. Phone numbers for our worldwide offices are listed at the front of this manual. You also can visit the Worldwide Offices section of ni.com/niglobal to access the branch office Web sites, which provide up-to-date contact information, support phone numbers, email addresses, and current events.
D-1
Glossary
Symbol m k M Prefix milli kilo mega Value 10 3 10 3 10 6
Numbers/Symbols
1D 2D 3D Delta; difference. x denotes the value by which x changes from one index to the next. Pi. Infinity. One-dimensional. Two-dimensional. Three-dimensional.
A
A absolute coordinates absolute path AC active window Amperes. Picture coordinates relative to the origin (0, 0) of the picture indicator. File or directory path that describes the location relative to the top level of the file system. Alternating current. Window that is currently set to accept user input, usually the frontmost window. The title bar of an active window is highlighted. Make a window active by clicking it or by selecting it from the Windows menu.
G-1
Glossary
Application created using the LabVIEW Development System and executed in the LabVIEW Run-Time System environment. Ordered, indexed list of data elements of the same type. Condition in a dataflow programming language in which the arrival of data, rather than its value, triggers execution of a node. American Standard Code for Information Interchange. Capability of loop structures to disassemble and assemble arrays at their borders. As an array enters a loop with auto-indexing enabled, the loop automatically disassembles it extracting scalars from ID arrays, ID arrays extracted from 2D arrays, and so on. Loops assemble data into arrays as data exit the loop in the reverse order. Ability of scales to adjust to the range of plotted values. On graph scales, autoscaling determines maximum and minimum scale values.
autoscaling
B
block diagram Pictorial description or representation of a program or algorithm. The block diagram, consists of executable icons called nodes and wires that carry data between the nodes. The block diagram is the source code for the VI. The block diagram resides in the block diagram window of the VI. Front panel objects to manipulate and display Boolean (TRUE or FALSE) data. Pause in execution used for debugging. Tool to set a breakpoint on a VI, node, or wire. Button that replaces the Run button when a VI cannot run because of errors. VI that cannot or run because of errors; signified by a broken arrow in the broken Run button. Temporary storage for acquired or generated data. File that stores data as a sequence of ASCII characters or bytes.
Boolean controls and indicators breakpoint Breakpoint tool broken Run button broken VI buffer byte stream file
G-2
ni.com
Glossary
C
case Case structure One subdiagram of a Case structure. Conditional branching control structure, that executes one of its subdiagrams based on the input to the Case structure. It is the combination of the IF, THEN, ELSE, and CASE statements in control flow languages. 1. Physicala terminal or pin at which you can measure or generate an analog or digital signal. A single physical channel can include more than one terminal, as in the case of a differential analog input channel or a digital port of eight lines. A counter also can be a physical channel, although the counter name is not the name of the terminal where the counter measures or generates the digital signal. 2. Virtuala collection of property settings that can include a name, a physical channel, input terminal connections, the type of measurement or generation, and scaling information. You can define NI-DAQmx virtual channels outside a task (global) or inside a task (local). Configuring virtual channels is optional in Traditional NI-DAQ and earlier versions, but is integral to every measurement you take in NI-DAQmx. In Traditional NI-DAQ, you configure virtual channels in MAX. In NI-DAQmx, you can configure virtual channels either in MAX or in your program, and you can configure channels as part of a task or separately. 3. Switcha switch channel represents any connection point on a switch. It may be made up of one or more signal wires (commonly one, two, or four), depending on the switch topology. A virtual channel cannot be created with a switch channel. Switch channels may be used only in the NI-DAQmx Switch functions and VIs. Unique name given to a channel configuration in the DAQ Channel Wizard. 2D display of one or more plots in which the display retains a history of previous data, up to a maximum that you define. The chart receives the data and updates the display point by point or array by array, retaining a certain number of past points in a buffer for display purposes. See also scope chart, strip chart, and sweep chart. Small square box in a dialog box you can select or clear. Checkboxes generally are associated with multiple options that you can set. You can select more than one checkbox. See Code Interface Node (CIN).
channel
checkbox
CIN
G-3
Glossary
class
A category containing properties, methods, and events. Classes are arranged in a hierarchy with each class inheriting the properties and methods associated with the class in the preceding level. To make a copy of a control or another object by clicking it while pressing the <Ctrl> key and dragging the copy to its new location.
(Mac OS) Press the <Option> key. (Sun) Press the <Meta> key. (Linux) Press
cloning
mouse button and then dragging the copy to its new location. cluster A set of ordered, unindexed data elements of any data type, including numeric, Boolean, string, array, or cluster. The elements must be all controls or all indicators. CIN. Special block diagram node through which you can link text-based code to a VI. Automatic conversion LabVIEW performs to change the numeric representation of a data element. Appears on a block diagram node to alert you that you have wired data of two different numeric data types together. Also appears when you wire any data type to a variant data type. Copies colors for pasting with the Coloring tool. Tool to set foreground and background colors. Process that converts high-level code to machine-executable code. LabVIEW compiles VIs automatically before they run for the first time after you create or edit alteration. Terminal of a While Loop that contains a Boolean value that determines if the VI performs another iteration. Refers to Measurement & Automation Explorer on Windows and to the NI-DAQ Configuration Utility on Mac OS. Part of the VI or function node that contains input and output terminals. Data pass to and from the node through a connector.
G-4
ni.com
Glossary
connector pane
Region in the upper right corner of a front panel or block diagram window that displays the VI terminal pattern. It defines the inputs and outputs you can wire to a VI. See universal constant and user-defined constant. Window that displays basic information about LabVIEW objects when you move the cursor over each object. Objects with context help information include VIs, functions, constants, structures, palettes, properties, methods, events, and dialog box components. Front panel object for entering data to a VI interactively or to a subVI programmatically, such as a knob, push button, or dial. Programming system in which the sequential order of instructions determines execution order. Most text-based programming languages are control flow languages. Palette that contains front panel controls, indicators, and decorative objects. Changing the type of a data element. Terminal of a For Loop whose value determines the number of times the For Loop executes its subdiagram. VI whose front panel, block diagram, or Icon Editor is the active window. Special parametric plot (x(t), y(t), z(t)), where the parameter t runs over a given interval.
D
D DAQ DAQ Channel Wizard Delta; Difference. x denotes the value by which x changes from one index to the next. See data acquisition (DAQ). Utility that guides you through naming and configuring DAQ analog and digital channels. Available in the (Windows) Data Neighborhood of Measurement & Automation Explorer or (Mac OS) DAQ Channel Wizard.
G-5
Glossary
1. Acquiring and measuring analog or digital electrical signals from sensors, transducers, and test probes or fixtures. 2. Generating analog or digital electrical signals. Condition in a dataflow programming language in which a node cannot execute until it receives data from another node. See also artificial data dependency. Programming system that consists of executable nodes that execute only when they receive all required input data and produce output automatically when they execute. LabVIEW is a dataflow system. File that stores data as a sequence of records of a single, arbitrary data type that you specify when you create the file. Although all the records in a datalog file must be a single type, that type can be complex. For example, you can specify that each record is a cluster that contains a string, a number, and an array. Generally, to acquire data and simultaneously store it in a disk file. LabVIEW File I/O VIs and functions can log data. Format for information. In LabVIEW, acceptable data types for most VIs and functions are numeric, array, string, Boolean, path, refnum, enumeration, waveform, and cluster. Preset value. Many VI inputs use a default value if you do not specify a value. An instrument or controller you can access as a single entity that controls or monitors real-world I/O points. A device often is connected to a host computer through some type of communication network. Structure for organizing files into convenient groups. A directory is like an address that shows the location of files. A directory can contain files or subdirectories of files. Having discontinuous values of the independent variable, usually time. Addition of Gaussian noise to an analog input signal. By applying dithering and then averaging the input data, you can effectively increase the resolution by another one-half bit. Dynamic Link Library.
data dependency
data flow
datalog file
default device
directory
discrete dithering
DLL
G-6
ni.com
Glossary
To use the cursor on the screen to select, move, copy, or delete objects. Letter in the range az followed by a colon (:), to indicate a logical disk drive. Software unique to the device or type of device, and includes the set of commands the device accepts.
E
empty array Array that has zero elements but has a defined data type. For example, an array that has a numeric control in its data display window but has no defined values for any element is an empty numeric array. Error structure that enters a VI. Indication of a software or hardware malfunction or of an unacceptable data entry attempt. The error structure that leaves a VI. Consists of a Boolean status indicator, a numeric code indicator, and a string source indicator. Condition or state of an analog or digital signal. Node attached to the left and right sides of an Event structure indicating the available data for the event you configured that case to handle. If you configure a single case to handle multiple events, only the data that is common to all handled event types is available. Debugging technique that animates VI execution to illustrate the data flow in the VI. Voltage pulse from an external source that triggers an event, such as A/D conversion.
error in error message error out error structure event Event Data Node
F
FIFO file refnum First-in-first-out memory buffer. The first data stored is the first data sent to the acceptor. See refnum.
G-7
Glossary
Allow control over how the user interface behaves. Type of signal conditioning that allows you to filter unwanted signals from the signal you are trying to measure. Program control structure that executes its subdiagrams in numeric order. Use this structure to force nodes that are not data dependent to execute in the order you want. The Flat Sequence structure displays all the frames at once and executes the frames from left to right until the last frame executes. Data of any type that has been converted to a string, usually for writing the data to a file. Iterative loop structure that executes its subdiagram a set number of times. Equivalent to text-based code: For i = 0 to n 1, do... Node that executes equations you enter as text. Especially useful for lengthy equations too cumbersome to build in block diagram form. Subdiagram of a Flat or Stacked Sequence structure. Label on the front panel or block diagram that does not belong to any other object. Interactive user interface of a VI. Front panel appearance imitates physical instruments, such as oscilloscopes and multimeters. Built-in execution element, comparable to an operator, function, or statement in a text-based programming language. Palette that contains VIs, functions, block diagram structures, and constants.
flattened data For Loop Formula Node frame free label front panel function Functions palette
G
General Purpose Interface Bus GPIBsynonymous with HP-IB. The standard bus used for controlling electronic instruments with a computer. Also called IEEE 488 bus because it is defined by ANSI/IEEE Standards 488-1978, 488.1-1987, and 488.2-1992. Accesses and passes data among several VIs on a block diagram. Small picture or icon.
G-8
ni.com
Glossary
See General Purpose Interface Bus. 2D display of one or more plots. A graph receives and plots data as a block. Front panel object that displays data in a Cartesian plane. Collection of input or output channels or ports that you define. Groups can contain analog input, analog output, digital input, digital output, or counter/timer channels. A group can contain only one type of channel. Use a task ID number to refer to a group after you create it. You can define up to 16 groups at one time. To erase a group, pass an empty channel array and the group number to the group configuration VI. You do not need to erase a group to change its membership. If you reconfigure a group whose task is active, LabVIEW clears the task and returns a warning. LabVIEW does not restart the task after you reconfigure the group.
H
handle Pointer to a pointer to a block of memory that manages reference arrays and strings. An array of strings is a handle to a block of memory that contains handles to strings. Hexadecimal. Base-16 number system. Window that graphically displays the hierarchy of VIs and subVIs.
I
I/O Input/Output. The transfer of data to or from a computer system involving communications channels, operator input devices, and/or data acquisition and control interfaces. Graphical representation of a node on a block diagram. Institute for Electrical and Electronic Engineers. Front panel object that displays output, such as a graph or LED. Digital display value for a floating-point representation of infinity.
G-9
Glossary
The condition in which two or more terminals, such as error I/O terminals or shift registers, use the same memory space. VI that controls a programmable instrument. Any of the natural numbers, their negatives, or zero. Method of displaying three dimensions of data on a 2D plot with the use of color. Internet protocol. Terminal of a For Loop or While Loop that contains the current number of completed iterations.
L
label Labeling tool LabVIEW Text object used to name or describe objects or regions on the front panel or block diagram. Tool to create labels and enter text into text windows. Laboratory Virtual Instrument Engineering Workbench. LabVIEW is a graphical programming language that uses icons instead of lines of text to create programs. The date and time that LabVIEW uses as a reference for absolute time. LabVIEW system time is defined as 12:00 a.m., January 1, 1904, Universal time. Light-emitting diode. Object a graph or chart owns to displays the names and plot styles of plots on that graph or chart. See VI library. Box within a dialog box that lists all available choices for a command. For example, a list of filenames on a disk. VI Library. Variable that enables you to read or write to one of the controls or indicators on the front panel of a VI.
G-10
ni.com
Glossary
M
matrix Measurement & Automation Explorer memory buffer menu bar A rectangular array of numbers or mathematical elements that represent the coefficients in a system of linear equations. The standard National Instruments hardware configuration and diagnostic environment for Windows. See buffer. Horizontal bar that lists the names of the main menus of an application. The menu bar appears below the title bar of a window. Each application has a menu bar that is distinct for that application, although some menus and commands are common to many applications. A procedure that is executed when an object receives a message. A method is always associated with a class. Application that runs several different threads of execution independently. On a multiple processor computer, the different threads might be running on different processors simultaneously.
N
NaN
Digital display value for a floating-point representation of not a number. Typically the result of an undefined operation, such as log(1). Driver software included with all NI measurement devices. NI-DAQ is an extensive library of VIs and functions you can call from an application development environment (ADE), such as LabVIEW, to program all the features of an NI measurement device, such as configuring, acquiring, and generating data from, and sending data to the device. The new NI-DAQ driver with new VIs, functions, and development tools for controlling measurement devices. The advantages of NI-DAQmx over earlier versions of NI-DAQ include the DAQ Assistant for configuring measurement tasks, channels, and scales; increased performance; expanded functionality; and a simpler application programming interface (API). Program execution element. Nodes are analogous to statements, operators, functions, and subroutines in text-based programming languages. On a block diagram, nodes include functions, structures, and subVIs.
NI-DAQ
NI-DAQmx
node
G-11
Glossary
Tell LabVIEW that a user action has already occurred, such as when a user changes the value of a control. Front panel objects to manipulate and display numeric data.
O
object Object Shortcut Menu tool OLE one-dimensional Operating tool Generic term for any item on the front panel or block diagram, including controls, indicators, nodes, wires, and imported pictures. Tool to access a shortcut menu for an object. Object Linking and Embedding. Having one dimension, as in the case of an array that has only one row of elements. Tool to enter data into controls operate them.
P
palette panel window picture picture indicator pixel pixmap plot Display of icons that represent possible options. VI window that contains the front panel, the toolbar, and the icon and connector panes. Series of graphics instructions that a picture indicator uses to create a picture. General-purpose indicator for displaying pictures that can contain lines, circles, text, and other types of graphic shapes. Smallest unit of a digitized picture. Standard format for storing pictures in which a color value represents each pixel. A bitmap is a black and white version of a pixmap. Graphical representation of an array of data shown either on a graph or a chart.
G-12
ni.com
Glossary
point polymorphism Positioning tool PPC probe Probe tool Property Node pull-down menus PXI
Cluster that contains two 16-bit integers that represent horizontal and vertical coordinates. Ability of a node to automatically adjust to data of different representation, type, or structure. Tool to move and resize objects. Program-to-program communication. Debugging feature for checking intermediate values in a VI. Tool to create probes on wires. Sets or finds the properties of a VI or application. Menus accessed from a menu bar. Pulldown menu items are usually general in nature. PCI eXtensions for Instrumentation. A modular, computer-based instrumentation platform.
R
race condition range rectangle Occurs when two or more pieces of code that execute in parallel change the value of the same shared resource, typically a global or local variable. Region between the limits within which a quantity is measured, received, or transmitted. Expressed by stating the lower and upper range values. Cluster that contains four 16-bit integers. The first two values describe the vertical and horizontal coordinates of the top left corner. The last two values describe the vertical and horizontal coordinates of the bottom right corner. Reference number. An identifier that LabVIEW associates with a file you open. Use the refnum to indicate that you want a function or VI to perform an operation on the open file. Picture coordinates relative to the current location of the pen. Subtype of the numeric data type, of which there are 8-bit, 16-bit, and 32-bit signed and unsigned integers, as well as single-, double-, and extended-precision floating-point numbers.
refnum
G-13
Glossary
Circles or handles that appear on the borders of an object to indicate the points where you can resize the object. Special numeric control that associates 32-bit integers, starting at 0 and increasing sequentially, with a series of text labels or graphics.
S
sample scalar Single analog or digital input or output data point. Number that a point on a scale can represent. A single value as opposed to an array. Scalar Booleans and clusters are explicitly singular instances of their respective data types. Part of graph, chart, and some numeric controls and indicators that contains a series of marks or points at known intervals to denote units of measure. Numeric indicator modeled on the operation of an oscilloscope. Tool to move through windows. Signal Conditioning eXtensions for Instrumentation. The National Instruments product line for conditional low-level signals within an external chassis near sensors, so only high-level signals in a noisy environment are sent to DAQ devices. Terminal to pass data between the frames of a Stacked Sequence structure. See Flat Sequence structure or Stacked Sequence structure. A file containing executable program modules that any number of different programs can use to perform some function. Shared libraries are useful when you want to share the functionality of the VIs you build with other developers. Optional mechanism in loop structures to pass the value of a variable from one iteration of a loop to a subsequent iteration. Shift registers are similar to static variables in text-based programming languages. Menu accessed by right-clicking an object. Menu items pertain to that object specifically. Moveable part of slide controls and indicators.
shift register
G-14
ni.com
Glossary
Program control structure that executes its subdiagrams in numeric order. Use this structure to force nodes that are not data dependent to execute in the order you want. The Stacked Sequence structure displays each frame so you see only one frame at a time and executes the frames in order until the last frame executes. Representation of a value as text. Front panel objects to manipulate and display text. Numeric plotting indicator modeled after a paper strip chart recorder, which scrolls as it plots data. Program control element, such as a Flat Sequence structure, Stacked Sequence structure, Case structure, For Loop, or While Loop. Block diagram within the border of a structure. VI used on the block diagram of another VI. Comparable to a subroutine. Numeric indicator modeled on the operation of an oscilloscope. It is similar to a scope chart, except that a line sweeps across the display to separate old data from new data. Set of rules to which statements must conform in a particular programming language.
string string controls and indicators strip chart structure subdiagram subVI sweep chart
syntax
T
TCP/IP Transmission Control Protocol/Internet Protocol. A standard format for transmitting data in packets from one computer to another. The two parts of TCP/IP are TCP, which deals with the construction of data packets, and IP, which routes them from computer to computer. Object or region on a node through which data pass. Small yellow text banners that identify the terminal name and make it easier to identify terminals for wiring. Special cursor to perform specific operations. Bar that contains command buttons to run and debug VIs.
G-15
Glossary
Palette that contains tools you can use to edit and debug front panel and block diagram objects. VI at the top of the VI hierarchy. This term distinguishes the VI from its subVIs. Data entry or exit terminal on a structure. Having two dimensions, as in the case of an array that has several rows and columns. Master copy of a custom object that several VIs can use.
U
UDP universal constant URL User Datagram Protocol. Uneditable block diagram object that emits a particular ASCII character or standard numeric constant, for example, . Uniform resource locator. A logical address that identifies a resource on a server, usually on the Web. For example, http://www.ni.com/ is the URL for the National Instruments Web site. Block diagram object that emits a value you set.
user-defined constant
V
vector VI VI class VI library VI Server virtual instrument (VI) 1D array. See virtual instrument (VI). A reference to a virtual instrument that allows access to VI properties and methods. Special file that contains a collection of related VIs for a specific use. Mechanism for controlling VIs and LabVIEW applications programmatically, locally and remotely. Program in LabVIEW that models the appearance and function of a physical instrument.
G-16
ni.com
Glossary
VISA. Single interface library for controlling GPIB, VXI, RS-232, and other types of instruments. See Virtual Instrument Software Architecture. VME eXtensions for Instrumentation (bus).
W
waveform waveform chart While Loop wire wire bend 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. Point where two wire segments join. 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. Truncated wires that appear next to unwired terminals when you move the Wiring tool over a VI or function node. Tool to define data paths between terminals.
G-17
Index
Numerics
2D controls and indicators, 4-9 3D controls and indicators, 4-9 3D graphs, 12-17 setting parameters using constants, 19-11 setting properties, 19-9 setting properties programmatically, 19-10 VI Server, 17-1 viewing properties, 19-9 VIs, 19-7 ActiveX Container design mode, 19-9 adding controls to libraries, 3-6 directories to VI search path. See the LabVIEW Help. graphic to VI icon. See the LabVIEW Help. instances to polymorphic VIs. See the LabVIEW Help. space to front panel, 4-9 terminals to functions, 5-10 VIs to libraries, 3-6 add-on toolsets, 1-1 on palettes, 3-8 advanced functions, 5-10 aligning objects, 4-6 See also the LabVIEW Help. animated front panel images, 18-11 annotations, 4-26 editing. See the LabVIEW Help. anti-aliased line plots, 12-2 Apple events, 18-20 Application Builder. See stand-alone applications. application control functions, 5-10 application font, 4-27 application notes, 1-3 Application object manipulating settings, 17-3 VI Server, 17-3
A
abridged menus, 3-3 acquiring digital data subset, 4-22 ActiveX, 19-1 accessing ActiveX-enabled applications, 19-8 building subpalettes, 3-7 callback VI, 19-13 clients, 19-7 constants for setting parameters, 19-11 containers, 19-7 controls, 19-7 custom interfaces, 19-11 design mode, 19-9 events, 19-6, 19-12 for running script nodes, 21-1 functions, 19-7 handling events, 19-13 indicators, 19-7 inserting objects on front panel, 19-8 invoking methods. See the LabVIEW Help. networking and, 18-1 objects, 19-6 properties, 19-6 Property Browser, 19-9 Property Node, 19-10 property pages, 19-9 remote front panels, 18-15 selecting custom interfaces, 19-8 servers, 19-11
I-1
Index
applications building stand-alone, 7-15 distributing VIs, 7-14 building VI Server, 17-2 arithmetic. See equations. arrays auto-indexing loops, 8-4 building with loops, 8-5 comparing, C-2 constants, 10-11 controls and indicators, 4-14 data type (table), 5-3 converting clusters to and from. See the LabVIEW Help. creating, 10-11 default data, 6-11 deleting elements. See the LabVIEW Help. dimensions, 10-8 examples 1D arrays, 10-9 2D arrays, 10-10 functions, 5-8 global variables, 11-5 indexes, 10-8 display, 10-12 inserting elements. See the LabVIEW Help. moving. See the LabVIEW Help. polymorphism, B-5 replacing elements. See the LabVIEW Help. resizing. See the LabVIEW Help. restrictions, 10-11 size of, 6-11 artificial data dependency, 5-27 ASCII using character set, 18-17 assigning passwords to block diagrams, 7-14
attributes variant data, 5-23 auto-constant labels displaying. See the LabVIEW Help. auto-indexing default data, 6-11 For Loops, 8-4 While Loops, 8-5 automatic wire routing, 5-14 automatic wiring, 5-12 automation custom interfaces, 19-11 refnum control, 19-7
B
back panel. See block diagram. background color of front panel objects. See the LabVIEW Help. binary creating files, 14-9 file I/O, 14-3 floating-point arithmetic, 6-10 bitmap files, 13-6 blink speed. See the LabVIEW Help. block diagram, 2-2 adding space without resizing, 5-29 aligning objects, 4-6 See also the LabVIEW Help. coercion dots, 5-15 commenting out sections, 6-9 constants, 5-5 controlling source code, 7-2 copying objects. See the LabVIEW Help. creating controls and indicators. See the LabVIEW Help. data flow, 5-25 data types (table), 5-2 DataSocket, 18-6 deleting objects. See the LabVIEW Help. designing, 5-28
I-2
ni.com
Index
distributing objects, 4-6 See also the LabVIEW Help. finding terminals. See the LabVIEW Help. fonts, 4-27 functions, 5-7 inserting objects. See the LabVIEW Help. labels, 4-26 creating. See the LabVIEW Help. editing. See the LabVIEW Help. resizing. See the LabVIEW Help. nodes, 5-6 objects, 5-1 options, 3-8 password protecting, 7-14 planning, 7-1 printing, 15-5 removing objects. See the LabVIEW Help. reordering objects. See the LabVIEW Help. replacing objects. See the LabVIEW Help. spacing objects evenly, 4-6 See also the LabVIEW Help. structures, 8-1 using. See the LabVIEW Help. terminals adding to functions, 5-10 control and indicator (table), 5-2 displaying, 5-2 front panel objects and, 5-1 removing from functions, 5-10 variant data, 5-22 VI Server, 17-1 wiring automatically, 5-12 wiring manually, 5-11, 5-13 BMP files, 13-6 Boolean controls and indicators, 4-12 comparing values, C-1 data type (table), 5-3 using. See the LabVIEW Help. Boolean functions, 5-7 polymorphism, B-4
National Instruments Corporation I-3
Breakpoint tool debugging VIs, 6-8 highlighting breakpoints. See the LabVIEW Help. broken VIs common causes, 6-3 correcting, 6-2 displaying errors, 6-2 broken wires, 5-14 buffered data DataSocket, 18-7 local variables, 11-5 building block diagram, 5-1 front panel, 4-1 instrument driver applications. See the LabVIEW Help. polymorphic VIs, 5-17 shared libraries distributing VIs, 7-14 stand-alone applications distributing VIs, 7-14 subVIs, 7-4 VI Server applications, 17-2 VIs, 7-1 buttons controlling with keyboard shortcuts, 4-4 front panel, 4-12 byte stream files, 14-3
C
C code calling from LabVIEW, 20-1 calculating equations, 21-1 Call By Reference Node, 17-7 Call Library Function Node, 20-1 callback VI ActiveX, 19-13
Index
callers chain of, 6-9 displaying, 6-9 calling code from text-based programming languages, 20-1 calling VIs dynamically, 17-7 canceling existing errors. See the LabVIEW Help. captions, 4-27 creating. See the LabVIEW Help. subVI tip strips. See the LabVIEW Help. Case structures data types, 8-11 error handling, 6-14 selector terminals values, 8-11 specifying a default case, 8-11 using. See the LabVIEW Help. chain of callers displaying, 6-9 changing palette views. See the LabVIEW Help. character formatting, 4-27 character set ASCII, 18-17 ISO Latin-1, 18-17 Mac OS, 18-17 using in email, 18-16 charts, 12-1 adding plots. See the LabVIEW Help. anti-aliased line plots, 12-2 clearing. See the LabVIEW Help. creating. See the LabVIEW Help. customizing appearance, 12-3 customizing behavior, 12-6 history length, 12-7 intensity, 12-12 options, 12-14 multiple scales, 12-2 options, 12-2 overlaid plots, 12-7
scale formatting, 12-5 scrolling, 12-3 stacked plots, 12-7 types, 12-1 waveform, 12-11 zooming. See the LabVIEW Help. checking available disk space. See the LabVIEW Help. CIN, 20-1 classic controls and indicators, 4-9 clearing graphs and charts. See the LabVIEW Help. indicators. See the LabVIEW Help. clients ActiveX, 19-7 LabVIEW for remote front panels, 18-13 multiple for remote front panels, 18-12 .NET, 19-4 Web browser for remote front panels, 18-14 cloning objects on front panel or block diagram. See the LabVIEW Help. clusters comparing, C-2 controls and indicators, 4-14 data type (table), 5-3 converting arrays to and from. See the LabVIEW Help. error, 6-13 components, 6-13 reports. See the LabVIEW Help. functions, 5-8 moving. See the LabVIEW Help. order of elements modifying, 10-14 See also the LabVIEW Help. polymorphism, B-6 resizing. See the LabVIEW Help. wire patterns, 10-14 Code Interface Node, 20-1 coercion dots, 5-15
I-4
ni.com
Index
color boxes, 4-11 creating in graphics, 13-6 high-color controls and indicators, 4-9 low-color controls and indicators, 4-9 mapping, 12-13 modifying in graphics, 13-6 options, 3-8 picker, 4-12 ramps rotary controls and indicators, 4-12 coloring background objects. See the LabVIEW Help. defining user colors. See the LabVIEW Help. foreground objects. See the LabVIEW Help. front panel objects, 4-5 copying colors. See the LabVIEW Help. system colors, 4-29 See also the LabVIEW Help. transparent objects. See the LabVIEW Help. combo boxes, 4-13 command line launching VIs. See the LabVIEW Help. commenting out sections of a block diagram debugging VIs, 6-9 communication, 18-1 ActiveX, 19-1 Apple events, 18-20 DataSocket, 18-2 executing system-level commands, 18-20 file I/O, 14-1 functions, 7-4 low-level, 18-19 Mac OS, 18-20 pipes, 18-20 PPC, 18-20
protocols, 18-19 System Exec VI, 18-20 TCP, 18-19 UDP, 18-19 UNIX, 18-20 VI Server, 17-1 VIs, 7-4 compacting memory. See the LabVIEW Help. comparing arrays, C-2 Boolean values, C-1 clusters, C-2 numerics, C-2 strings, C-1 versions of VIs, 7-2 Comparison functions, C-1 polymorphism, B-6 computer-based instruments configuring, 1-4 conditional terminals, 8-2 configuration file VIs format, 14-13 purpose, 14-12 reading and writing .ini files, 14-12 configuring dynamic events. See the LabVIEW Help. front panel, 4-3 front panel controls, 4-1 front panel indicators, 4-1 menus, 16-2 servers for remote front panels, 18-12 LabVIEW, 18-14 Web browser, 18-14 user events. See the LabVIEW Help. VI appearance and behavior, 16-1 connecting terminals, 5-11 connector panes, 2-4 printing, 15-3 required and optional inputs and outputs, 7-8 setting up, 7-6
I-5 LabVIEW User Manual
Index
constants, 5-5 arrays, 10-11 creating. See the LabVIEW Help. editing. See the LabVIEW Help. setting parameters with ActiveX, 19-11 universal, 5-5 user-defined, 5-5 contacting National Instruments, D-1 containers, 4-18 ActiveX, 19-7 subpanel controls, 4-19 tab controls, 4-18 Context Help window, 3-4 creating object descriptions, 15-2 creating VI descriptions, 15-2 terminal appearance, 7-8 continuously running VIs, 6-1 control flow programming model, 5-25 control references, 17-8 creating. See the LabVIEW Help. strictly typed, 17-9 weakly typed, 17-9 controlling front panel objects programmatically, 17-8 front panel objects remotely. See the LabVIEW Help. instruments, 7-3 source code, 7-2 VIs programmatically, 17-1 VIs remotely, 18-12 VIs when called as subVIs, 7-4 controls, 4-1 2D, 4-9 3D, 4-9 ActiveX, 19-7 adding to libraries, 3-6 array, 4-14 automation refnum, 19-7 Boolean, 4-12 using. See the LabVIEW Help.
captions for subVI tip strips. See the LabVIEW Help. changing to indicators, 4-2 classic, 4-9 cluster, 4-14 color box, 4-11 color ramp, 4-12 coloring, 4-5 creating on block diagram. See the LabVIEW Help. data type terminals, 5-1 data types (table), 5-2 dialog, 4-25 using. See the LabVIEW Help. digital, 4-11 displaying optional elements, 4-2 enumerated type, 4-17 advanced, 4-18 using. See the LabVIEW Help. grouping and locking, 4-6 guidelines for using on front panel, 4-29 hidden. See the LabVIEW Help. hiding See also the LabVIEW Help. optional elements, 4-2 high-color, 4-9 I/O name, 4-20 icons, 5-1 keyboard shortcuts, 4-3 listbox, 4-15 using. See the LabVIEW Help. low-color, 4-9 naming, 7-11 numeric, 4-10 using. See the LabVIEW Help. on block diagram, 5-1 optional, 7-8 palette, 3-1 customizing, 3-6 navigating and searching, 3-2
I-6
ni.com
Index
path, 4-14 using. See the LabVIEW Help. printing, 15-3 refnum, 4-25 using. See the LabVIEW Help. replacing, 4-2 required, 7-8 resizing, 4-6 in relation to window size, 4-7 ring, 4-17 using. See the LabVIEW Help. rotary, 4-10 slide, 4-10 string, 4-13 display types, 10-2 tables, 10-2 style, 16-2 tab, 4-18 terminals data types, 5-1 icons, 5-1 terminals (table), 5-2 time stamp, 4-11 type definitions, 4-1 user interface design, 4-29 conventions used in this manual, xxii converting arrays to and from clusters. See the LabVIEW Help. directories to libraries. See the LabVIEW Help. LabVIEW data types to HTML, 10-7 libraries to directories. See the LabVIEW Help. numerics to strings, 10-5 XML to LabVIEW data, 10-7 converting Express VIs to subVIs, 5-19 See also the LabVIEW Help. cooperation level setting. See the LabVIEW Help.
copying graphics, 4-5 objects on front panel or block diagram. See the LabVIEW Help. VIs, A-3 correcting broken wires, 5-14 VIs, 6-2 debugging techniques, 6-3 count terminals, 8-2 auto-indexing to set, 8-4 create .NET object. See the LabVIEW Help. creating arrays, 10-11 binary files, 14-9 charts. See the LabVIEW Help. control references. See the LabVIEW Help. datalog files, 14-9 graphs. See the LabVIEW Help. icons, 7-8 menus, 16-2 object descriptions, 15-2 palette views, 3-6 revision history, 15-1 spreadsheet files, 14-8 subpalettes. See the LabVIEW Help. subVIs, 7-10 situations to avoid. See the LabVIEW Help. text files, 14-8 tip strips, 15-2 user events, 9-12 user-defined constants, 5-5 VI descriptions, 15-2 creating subVIs from Express VIs, 5-19 See also the LabVIEW Help. cursors adding to graphs. See the LabVIEW Help.
I-7
Index
deleting from graphs. See the LabVIEW Help. graph, 12-4 custom automation interfaces, 19-11 Custom Probe Wizard, 6-7 customer education, D-1 professional services, D-1 technical support, D-1 customizing error codes. See the LabVIEW Help. menus, 16-2 palettes, 3-6 probes. See the LabVIEW Help. VI appearance and behavior, 16-1 work environment, 3-5
D
DAQ Channel Viewer, 1-4 Channel Wizard, 1-4 Configuration Utility, 1-4 passing channel names, 4-20 Solution Wizard, 1-4 VIs and functions, 7-3 data emailing from VIs, 18-16 data acquisition. See DAQ. data bubbles displaying during execution highlighting. See the LabVIEW Help. data dependency, 5-26 artificial, 5-27 controlling with sequence structures, 8-14 flow-through parameters, 14-11 missing, 5-27 race conditions, 11-4 data flow observing, 6-5
data types Case structures, 8-11 control and indicator (table), 5-2 converting from XML, 10-7 converting to XML, 10-7 default values, 5-2 MATLAB (table), 21-5 .NET, 19-5 printing, 15-3 waveform, 12-18 dataflow programming model, 5-25 managing memory, 5-27 datalog file I/O, 14-4 creating files, 14-9 datalogging automatic, 14-15 changing log-file binding, 14-16 clearing log-file binding, 14-16 deleting records, 14-16 interactive, 14-15 retrieving data programmatically, 14-17 DataSocket, 18-2 block diagram, 18-6 buffered data, 18-7 closing connections programmatically, 18-7 controlling front panel objects. See the LabVIEW Help. formats for data, 18-4 front panel, 18-5 opening connections programmatically, 18-7 protocols, 18-3 URLs, 18-3 variant data, 18-9 deallocating memory. See the LabVIEW Help. debugging automatic error handling, 6-12 broken VIs, 6-2 creating probes. See the LabVIEW Help. default data, 6-11
I-8
ni.com
Index
disabling debugging tools, 6-10 executable VIs. See the LabVIEW Help. hidden wires, 5-28 loops, 6-11 MATLAB scripts, 21-5 options, 3-8 probes, 6-6 creating. See the LabVIEW Help. structures. See the LabVIEW Help. techniques, 6-3 Breakpoint tool, 6-8 commenting out sections of a block diagram, 6-9 error handling, 6-12 execution highlighting, 6-5 Probe tool, 6-6 single-stepping, 6-5 suspending execution, 6-9 tools disabling, 6-10 undefined data, 6-10 decimal point localized. See the LabVIEW Help. default cases, 8-11 default data arrays, 6-11 directory, 14-19 For Loops, 6-11 default probes, 6-7 default values data types, 5-2 defining error codes. See the LabVIEW Help. user colors. See the LabVIEW Help. deleting array elements. See the LabVIEW Help. broken wires, 5-14 datalog records, 14-16 objects on front panel or block diagram. See the LabVIEW Help.
palette views. See the LabVIEW Help. structures. See the LabVIEW Help. design mode ActiveX Container, 19-9 designing block diagram, 5-28 dialog boxes, 4-29 front panel, 4-28 projects, 7-1 subVIs, 7-10 developing VIs, 7-1 guidelines, 1-2 tracking development. See documenting VIs. diagnostic resources, D-1 dialog boxes controls, 4-25 using. See the LabVIEW Help. designing, 4-29 font, 4-27 indicators, 4-25 labels, 4-25 native file. See the LabVIEW Help. remote front panels, 18-15 ring controls, 4-17 dialog functions, 5-9 dials See also numerics. adding color ramps, 4-12 front panel, 4-10 digital controls and indicators, 4-11 digital data acquiring subset, 4-22 appending, 4-24 compressing, 4-24 digital waveform data type, 12-18 searching for pattern, 4-24 digital graphs anti-aliased line plots, 12-2 masking data, 12-17 digital waveform data type, 12-18
I-9 LabVIEW User Manual
Index
digital waveform graph configuring plots. See the LabVIEW Help. display digital data in, 12-14 dimensions arrays, 10-8 directories converting libraries to. See the LabVIEW Help. converting to libraries. See the LabVIEW Help. directory paths. See paths. directory paths. See probes. directory structure of LabVIEW Mac OS, A-2 organization, A-1 disabling automatic wire routing temporarily, 5-14 debugging tools, 6-10 sections of a block diagram debugging VIs, 6-9 disk space checking. See the LabVIEW Help. options, 3-8 disk streaming, 14-7 displaying auto-constant labels. See the LabVIEW Help. chain of callers, 6-9 errors, 6-2 front panels remotely, 18-12 hidden front panel objects. See the LabVIEW Help. optional elements in front panel objects, 4-2 terminals, 5-2 tip strips. See the LabVIEW Help. warnings, 6-2 distributing objects on the front panel, 4-6 See also the LabVIEW Help. VIs, 7-14
distributing objects, 4-6 See also the LabVIEW Help. DLLs building distributing VIs, 7-14 calling from LabVIEW, 20-1 Do Loops. See While Loops. documentation conventions used in this manual, xxii directory structure, A-2 guide, 1-1 introduction to this manual, xxi online library, D-1 organization of this manual, xxi PDF library, 1-1 using this manual, xxi using with other resources, 1-1 documenting VIs creating object and VI descriptions, 15-2 creating tip strips, 15-2 help files, 15-4 linking to help files you create. See the LabVIEW Help. printing, 15-3 programmatically, 15-3 revision history, 15-1 dots coercion, 5-15 dragging and dropping. See the LabVIEW Help. drawing See also graphics. smooth updates. See the LabVIEW Help. drivers instrument, D-1 LabVIEW. See the LabVIEW Help. software, D-1 drop-through clicking. See the LabVIEW Help. dstp DataSocket protocol, 18-3
I-10
ni.com
Index
dynamic data type, 5-20 converting from, 5-21 See also the LabVIEW Help. converting to, 5-22 See also the LabVIEW Help. dynamic events example, 9-10 registering, 9-8 registering. See the LabVIEW Help.
E
editing labels. See the LabVIEW Help. menus, 16-2 palette views, 3-6 shortcut menus of polymorphic VIs. See the LabVIEW Help. email character sets, 18-16 sending from VIs, 18-16 transliteration, 18-18 embedding objects using ActiveX, 19-8 empty paths, 4-14 enhanced probes. See probes. enumerated type controls, 4-17 advanced, 4-18 data type (table), 5-3 using. See the LabVIEW Help. equations Expression Nodes, 21-3 Formula Nodes, 21-1 integrating into LabVIEW, 21-1 MATLAB debugging scripts, 21-5 script node, 21-4 methods for using, 21-1 errors automatically handling, 6-12 broken VIs, 6-2
canceling existing. See the LabVIEW Help. checking for, 6-12 clusters, 6-13 components, 6-13 connector pane, 7-7 reports. See the LabVIEW Help. codes, 6-13 debugging techniques, 6-3 defining custom. See the LabVIEW Help. displaying, 6-2 exception control. See the LabVIEW Help. finding, 6-2 handling, 6-12 instrument control. See the LabVIEW Help. methods, 6-13 using Case structures, 6-14 using While Loops, 6-14 handling automatically, 6-12 I/O, 6-13 list, 6-2 normal conditions as. See the LabVIEW Help. notification. See the LabVIEW Help. units incompatible, 5-23 window, 6-2 Event structures See also events. using, 9-2 event-driven programming. See events; Event structures. events See also Event structures. ActiveX, 19-6, 19-12 available in LabVIEW. See the LabVIEW Help. configuring. See the LabVIEW Help. creating user, 9-12 defined, 9-1
I-11
Index
dynamic example, 9-10 registration, 9-8 dynamically registering. See the LabVIEW Help. filter, 9-4 front panel locking, 9-6 generating user, 9-13 handling, 9-5 handling ActiveX, 19-13 notify, 9-4 registering user, 9-12 static registration, 9-7 supported, 9-1 unregistering dynamic, 9-10 unregistering user, 9-13 user, 9-12 example code, D-1 examples, 1-4 arrays, 10-9 1D arrays, 10-9 2D arrays, 10-10 exception control. See the LabVIEW Help. executable VIs debugging. See the LabVIEW Help. executing system-level commands, 18-20 execution flow, 5-25 controlling with sequence structures, 8-14 highlighting debugging VIs, 6-5 displaying data bubbles. See the LabVIEW Help. probing automatically. See the LabVIEW Help. suspending debugging VIs, 6-9 expandable nodes, 7-9 Express VIs, 5-19 expandable nodes, 7-9
icons, 7-9 saving configurations as VIs, 5-19 See also the LabVIEW Help. Expression Nodes, 21-3
F
Feedback Node, 8-8 initializing, 8-10 replacing with shift registers, 8-10 file DataSocket protocol, 18-3 file I/O advanced file functions, 14-6 basic operation, 14-1 binary files, 14-3 creating, 14-9 byte stream files, 14-3 configuration file VIs format, 14-13 purpose, 14-12 reading and writing .ini files, 14-12 datalog files, 14-4 creating, 14-9 default data directory, 14-19 disk streaming, 14-7 flow-through parameters, 14-11 formats, 14-2 functions, 5-9 high-level VIs, 14-5 LabVIEW data format, 14-20 logging front panel data, 14-14 low-level VIs and functions, 14-6 .lvm file, 14-20 networking and, 18-1 paths, 14-6 reading waveforms, 14-10 refnums, 14-1 selecting default directory. See the LabVIEW Help. spreadsheet files creating, 14-8
I-12
ni.com
Index
text files, 14-2 creating, 14-8 writing waveforms, 14-10 file sharing, 7-2 filter events, 9-4 finding controls, VIs, and functions on the palettes, 3-2 errors, 6-2 objects, text, and VIs. See the LabVIEW Help. fixing VIs, 6-2 debugging techniques, 6-3 Flat Sequence structures, 8-13 See also sequence structures. replacing with Stacked Sequence, 8-16 flattened data variant data and, 5-23 floating-point numbers converting, B-1 overflow and underflow, 6-10 flow of execution, 5-25 flow-through parameters, 14-11 fonts application, 4-27 dialog, 4-27 options, 3-8 settings, 4-27 system, 4-27 For Loops auto-indexing to set count, 8-4 controlling timing, 8-10 count terminals, 8-2 default data, 6-11 iteration terminals, 8-2 shift registers, 8-6 using. See the LabVIEW Help. foreground color of front panel objects. See the LabVIEW Help. format string parameter, 10-4
formats for file I/O binary files, 14-3 datalog files, 14-4 text files, 14-2 formatting strings, 10-4 specifiers, 10-4 text on front panel, 4-27 formatting string. See the LabVIEW Help. Formula Nodes, 21-1 entering C-like statements, 21-2 entering equations, 21-2 illustration, 21-2 variables, 21-3 formulas. See equations. free labels, 4-26 creating. See the LabVIEW Help. frequently asked questions, D-1 front panel, 2-1 adding space without resizing, 4-9 aligning objects, 4-6 See also the LabVIEW Help. captions, 4-27 creating. See the LabVIEW Help. changing controls to and from indicators, 4-2 clearing indicators. See the LabVIEW Help. coloring objects, 4-5 background and foreground. See the LabVIEW Help. copying colors. See the LabVIEW Help. controlling objects programmatically, 17-8 controlling objects remotely. See the LabVIEW Help. controlling remotely, 18-12 controls, 4-9 copying objects. See the LabVIEW Help. datalogging, 14-14
I-13
Index
DataSocket, 18-5 defining window size. See the LabVIEW Help. deleting objects. See the LabVIEW Help. designing, 4-28 displaying optional object elements, 4-2 displaying with different screen resolutions, 4-30 distributing objects, 4-6 See also the LabVIEW Help. finding objects. See the LabVIEW Help. fonts, 4-27 grouping and locking objects, 4-6 hidden objects. See the LabVIEW Help. hiding objects. See the LabVIEW Help. optional object elements, 4-2 importing graphics, 4-5 indicators, 4-9 inserting objects using ActiveX, 19-8 keyboard shortcuts, 4-3 labels, 4-26 creating. See the LabVIEW Help. editing. See the LabVIEW Help. resizing. See the LabVIEW Help. loading in subpanel controls, 4-19 locking with events, 9-6 logging data, 14-14 objects block diagram terminals and, 5-1 options, 3-8 order of objects, 4-4 overlapping objects, 4-18 planning, 7-1 printing, 15-5 after the VI runs, 15-6 publishing images on Web, 18-11 removing objects. See the LabVIEW Help. reordering objects. See the LabVIEW Help. replacing objects, 4-2
resizing objects, 4-6 in relation to window size, 4-7 retrieving data using file I/O functions, 14-18 using subVIs, 14-17 scaling objects, 4-7 setting tabbing order, 4-4 spacing objects evenly, 4-6 See also the LabVIEW Help. style of controls and indicators, 16-2 subVIs, 7-10 text characteristics, 4-27 transparent objects. See the LabVIEW Help. type definitions, 4-1 viewing remotely, 18-12 ftp DataSocket protocol, 18-3 full menus, 3-3 function key settings overriding defaults. See the LabVIEW Help. functions, 5-7 adding terminals, 5-10 advanced, 5-10 application control, 5-10 array, 5-8 block diagram, 5-7 Boolean, 5-7 cluster, 5-8 dialog, 5-9 file I/O, 5-9 finding. See the LabVIEW Help. numeric, 5-7 palette customizing, 3-6 navigating and searching, 3-2 window titles. See the LabVIEW Help. polymorphic, B-1 reference. See the LabVIEW Help. removing terminals, 5-10
I-14
ni.com
Index
resizing. See the LabVIEW Help. string, 5-8 time, 5-9 waveform, 5-9
G
gauges See also numerics. adding color ramps, 4-12 front panel, 4-10 generating user events, 9-13 generating reports, 15-7 error clusters. See the LabVIEW Help. getting started, 1-1 GIF files, 15-4 global variables creating, 11-2 initializing, 11-4 memory, 11-5 race conditions, 11-4 read and write, 11-3 using carefully, 11-4 GPIB configuring, 1-4 graphics adding to VI icon. See the LabVIEW Help. creating colors, 13-6 dragging and dropping. See the LabVIEW Help. drawing shapes, 13-4 entering text, 13-4 formats, 13-6 for HTML files, 15-4 graphs, 13-2 importing, 4-5 modifying colors, 13-6 picture controls and indicators data type (table), 5-4 using, 13-1
pixmaps, 13-4 publishing front panels on Web, 18-11 graphs, 12-1 3D, 12-17 adding plots. See the LabVIEW Help. anti-aliased line plots, 12-2 clearing. See the LabVIEW Help. creating. See the LabVIEW Help. cursors, 12-4 adding. See the LabVIEW Help. deleting. See the LabVIEW Help. customizing appearance, 12-3 customizing behavior, 12-3 digital masking data, 12-17 graphics, 13-2 intensity, 12-12 options, 12-14 multiple scales, 12-2 options, 12-2 polar, 13-2 scale formatting, 12-5 scaling, 12-5 scrolling, 12-3 Smith plots, 13-3 smooth updates, 12-6 transmission lines, 13-3 types, 12-1 waveform, 12-8 data types, 12-9 XY, 12-8 data types, 12-10, 12-11 zooming. See the LabVIEW Help. grid, 4-6 options, 3-8 grouping data arrays, 10-8 clusters, 10-14 strings, 10-1
I-15
Index
front panel objects, 4-6 VIs in libraries, 7-12 guidelines for development, 1-2
H
handling events, 9-5 help See also Context Help window. professional services, D-1 technical support, D-1 help files, 1-2 creating your own, 15-4 HTML, 15-4 linking to VIs. See the LabVIEW Help. RTF, 15-4 hidden front panel objects. See the LabVIEW Help. hiding front panel objects. See the LabVIEW Help. menu bar, 4-26 optional elements in front panel objects, 4-2 scrollbars, 4-26 Hierarchy window, 7-11 printing, 15-3 searching. See the LabVIEW Help. highlighting execution debugging VIs, 6-5 history See also revision history. charts, 12-7 options, 3-8 hot menus. See the LabVIEW Help. HTML See also Web. creating documents, 18-11 generating reports, 15-7 graphics formats, 15-4 help files, 15-4
I
I/O controls and indicators, 4-20 data type (table), 5-4 error, 6-13 file. See file I/O. name controls and indicators, 4-20 icons, 2-4 creating, 7-8 editing, 7-8 Express VIs, 7-9 printing, 15-3 subVIs, 7-9 images. See graphics. impedance of transmission lines, 13-3 importing graphics, 4-5 incrementally running VIs, 6-5 indexes of arrays, 10-8 display, 10-12 indexing loops, 8-4 For Loops, 8-4 While Loops, 8-5 indicators, 4-1 2D, 4-9 3D, 4-9 ActiveX, 19-7 array, 4-14 Boolean, 4-12 using. See the LabVIEW Help. changing to controls, 4-2 classic, 4-9 clearing. See the LabVIEW Help. cluster, 4-14 color box, 4-11 color ramp, 4-12 coloring, 4-5
I-16
ni.com
Index
creating on block diagram. See the LabVIEW Help. data type terminals, 5-1 data types (table), 5-2 dialog, 4-25 digital, 4-11 displaying optional elements, 4-2 enumerated type advanced, 4-18 grouping and locking, 4-6 guidelines for using on front panel, 4-29 hidden. See the LabVIEW Help. hiding See also the LabVIEW Help. optional elements, 4-2 high-color, 4-9 I/O name, 4-20 icons, 5-1 low-color, 4-9 numeric, 4-10 using. See the LabVIEW Help. on block diagram, 5-1 optional, 7-8 path, 4-14 using. See the LabVIEW Help. printing, 15-3 refnum, 4-25 using. See the LabVIEW Help. replacing, 4-2 required, 7-8 resizing, 4-6 in relation to window size, 4-7 rotary, 4-10 slide, 4-10 string, 4-13 display types, 10-2 style, 16-2 tab, 4-18 terminals data types, 5-1 icons, 5-1
National Instruments Corporation I-17
terminals (table), 5-2 time stamp, 4-11 type definitions, 4-1 user interface design, 4-29 Inf (infinity) floating-point value undefined data, 6-10 infinite While Loops, 8-3 .ini files reading and writing, 14-12 inserting elements in arrays. See the LabVIEW Help. objects in palettes. See the LabVIEW Help. objects on block diagram. See the LabVIEW Help. installers building, 7-15 instances of polymorphic VIs See also polymorphic VIs. adding. See the LabVIEW Help. removing. See the LabVIEW Help. selecting manually, 5-16 instances of subVIs determining, 6-9 suspending execution, 6-9 instrument drivers, D-1 LabVIEW. See the LabVIEW Help. instrument library adding VIs and controls, 3-6 instruments configuring, 1-4 controlling, 7-3 integers converting, B-1 overflow and underflow, 6-10 intensity charts, 12-12 color mapping, 12-13 options, 12-14
Index
intensity graphs, 12-12 color mapping, 12-13 options, 12-14 Internet. See Web. invalid paths, 4-14 Invoke Node, 17-4 ActiveX, 19-7 ISO Latin-1 using character set, 18-17 iteration terminals For Loops, 8-2 While Loops, 8-3 IVI instrument drivers. See the LabVIEW Help. passing logical names, 4-20
J
Joint Photographic Experts Group files, 13-6 JPEG files, 13-6, 15-4 Web Server, 18-11
K
keyboard shortcuts, 4-3 controlling buttons, 4-4 setting tabbing order, 4-4 knobs See also numerics. adding color ramps, 4-12 front panel, 4-10 KnowledgeBase, D-1
L
labeling captions, 4-27 constants, 5-5 creating free labels. See the LabVIEW Help.
editing. See the LabVIEW Help. fonts, 4-27 global variables, 11-3 local variables, 11-2 resizing. See the LabVIEW Help. units of measure, 5-23 labels dialog box, 4-25 displaying auto-constant. See the LabVIEW Help. transparent. See the LabVIEW Help. LabVIEW, 1-1 customizing, 3-8 options, 3-8 labview.ini, 3-8 launching VIs from command line. See the LabVIEW Help. learning and instruction directory examples, A-2 libraries adding VIs and controls, 3-6 converting directories to. See the LabVIEW Help. converting to directories. See the LabVIEW Help. directory structure, A-1 instrument, A-1 managing, 7-13 marking VIs as top-level. See the LabVIEW Help. organization of, A-1 removing VIs from. See the LabVIEW Help. saving VIs as, 7-12 suggested location for, A-2 shared, 7-15 distributing VIs, 7-14 user, A-1 VI, A-1 licenses for serving remote front panels, 18-12 lights on front panel, 4-12
I-18
ni.com
Index
line plots anti-aliased, 12-2 linking VIs to HTML or compiled help files. See the LabVIEW Help. listbox controls, 4-15 using. See the LabVIEW Help. listboxes, 4-15 listing. See displaying. local variables, 11-1 creating, 11-2 finding objects or terminals. See the LabVIEW Help. initializing, 11-4 memory, 11-5 race conditions, 11-4 read and write, 11-3 using carefully, 11-4 localized decimal point. See the LabVIEW Help. localizing VIs, 7-15 location for saving files, A-2 locking Context Help window, 3-5 front panel objects, 4-6 front panels with events, 9-6 VIs. See the LabVIEW Help. Logarithmic functions polymorphism, B-7 log-file binding, 14-14 changing, 14-16 clearing, 14-16 logging data. See datalogging. logging in automatically. See the LabVIEW Help. login prompt at startup displaying. See the LabVIEW Help. logos DataSocket protocol, 18-3 loops auto-indexing, 8-4 building arrays, 8-5 controlling timing, 8-10
default data, 6-11 For, 8-2 infinite, 8-3 shift registers, 8-6 using. See the LabVIEW Help. While, 8-2 low-level communication, 18-19 .lvm file, 14-20
M
Mac OS using character set, 18-17 manual. See documentation. mapping characters, 18-18 mapping colors, 12-13 marking VIs as top-level in libraries. See the LabVIEW Help. masking digital data, 12-17 masking digital data,see digital data acquiring subset, 4-22 mathematics. See equations. MATLAB data types, 21-5 debugging scripts, 21-5 script node, 21-4 Measurement & Automation Explorer, 1-4 measurement units, 5-23 memory coercion dots, 5-15 compacting. See the LabVIEW Help. deallocating. See the LabVIEW Help. disabling debugging tools, 6-10 global variables, 11-5 local variables, 11-5 managing with dataflow programming model, 5-27 reading from and writing to with variant data, 5-22
I-19
Index
menu bar hiding, 4-26 Menu Editor, 16-2 menus, 3-3 abridged, 3-3 combo boxes, 4-13 editing, 16-2 handling selections, 16-3 hot. See the LabVIEW Help. reference. See the LabVIEW Help. ring controls, 4-17 shortcut, 3-4 editing for polymorphic VIs. See the LabVIEW Help. meters See also numerics. adding color ramps, 4-12 front panel, 4-10 methods ActiveX, 19-6 modules on palettes, 3-8 most recently used menu items, 3-3 moving arrays. See the LabVIEW Help. clusters. See the LabVIEW Help. objects. See the LabVIEW Help. subpalettes. See the LabVIEW Help. wires. See the LabVIEW Help. MRU menu items, 3-3 multicolumn listboxes. See listbox controls. multiple threads running. See the LabVIEW Help.
N
naming controls, 7-11 VIs, 7-13 NaN (not a number) floating-point value undefined data, 6-10
National Instruments customer education, D-1 professional services, D-1 system integration services, D-1 technical support, D-1 worldwide offices, D-1 native file dialog boxes. See the LabVIEW Help. navigation order. See tabbing order. needles adding, 4-10 .NET assemblies, 19-2 Class Libraries, 19-2 Common Language Runtime, 19-2 Constructor Node, 19-3 create object. See the LabVIEW Help. deploying applications, 19-5 environment, 19-2 functions., 19-3 Global Assembly Cache, 19-3 LabVIEW as client, 19-4 mapping data types, 19-5 .NET framework, 19-2 networking. See communication. NI-DAQ Configuration Utility, 1-4 nodes, 2-4 block diagram, 5-6 Call By Reference, 17-7 execution flow, 5-26 Invoke, 17-4 MATLAB script node, 21-4 Property, 17-4 resizing. See the LabVIEW Help. normal conditions as errors. See the LabVIEW Help. not a number (NaN) floating-point value undefined data, 6-10 Not a Path, 4-14 notification of errors. See the LabVIEW Help. notify events, 9-4
I-20
ni.com
Index
numbers overflow and underflow, 6-10 numerics changing representation. See the LabVIEW Help. comparing, C-2 controls and indicators, 4-10 using. See the LabVIEW Help. converting, B-1 data types (table), 5-2 equations, 21-1 formatting, 4-11 formulas, 21-1 functions, 5-7 out-of-range, 4-18 polymorphism, B-2 strings and, 10-5 units of measure, 5-23 universal constants, 5-5 writing data to spreadsheet or text files, 10-5
O
objects ActiveX, 19-6 aligning, 4-6 See also the LabVIEW Help. block diagram, 5-1 captions on front panel, 4-27 creating. See the LabVIEW Help. changing controls to and from indicators, 4-2 coloring on front panel, 4-5 copying colors. See the LabVIEW Help. controlling programmatically, 17-8 creating descriptions, 15-2 creating tip strips, 15-2 displaying optional elements, 4-2
distributing, 4-6 See also the LabVIEW Help. finding. See the LabVIEW Help. front panel and block diagram terminals, 5-1 grouping and locking on front panel, 4-6 hidden on front panel. See the LabVIEW Help. hiding on front panel See also the LabVIEW Help. optional elements, 4-2 inserting in palettes. See the LabVIEW Help. inserting on block diagram. See the LabVIEW Help. inserting on front panel using ActiveX, 19-8 labeling, 4-26 creating. See the LabVIEW Help. editing. See the LabVIEW Help. resizing. See the LabVIEW Help. moving. See the LabVIEW Help. overlapping on front panel, 4-18 printing descriptions, 15-3 reordering. See the LabVIEW Help. replacing on block diagram. See the LabVIEW Help. replacing on front panel, 4-2 resizing on front panel, 4-6 in relation to window size, 4-7 scaling on front panel, 4-7 selecting. See the LabVIEW Help. setting tabbing order on front panel, 4-4 spacing evenly, 4-6 See also the LabVIEW Help. transparent. See the LabVIEW Help. wiring automatically on block diagram, 5-12 wiring manually on block diagram, 5-11 OLE for Process Control DataSocket protocol, 18-3
I-21
Index
online technical support, D-1 opc DataSocket protocol, 18-3 opening VIs in run mode. See the LabVIEW Help. operators. See nodes. options setting, 3-8 See also the LabVIEW Help. storing, 3-8 order of cluster elements, 10-14 modifying, 10-14 See also the LabVIEW Help. order of execution, 5-25 controlling with sequence structures, 8-14 out-of-range numbers, 4-18 overflow of numbers, 6-10 overlaid plots, 12-7 overlapping front panel objects, 4-18 overriding default function key settings. See the LabVIEW Help. owned labels, 4-26 editing. See the LabVIEW Help.
P
palettes changing. See the LabVIEW Help. color picker, 4-12 Controls, 3-1 customizing, 3-6 customizing, 3-6 Functions, 3-1 customizing, 3-6 inserting objects. See the LabVIEW Help. modules, 3-8 navigating and searching, 3-2 options, 3-8 organizing, 3-6 reference. See the LabVIEW Help. sharing. See the LabVIEW Help. Tools, 3-3
toolsets, 3-8 updating. See the LabVIEW Help. views, 3-7 parameter lists. See connector panes. parameters data types (table), 5-2 password protection, 7-14 pasting graphics, 4-5 paths adding directories to VI search path. See the LabVIEW Help. controls and indicators, 4-14 data type (table), 5-3 using. See the LabVIEW Help. empty, 4-14 file I/O, 14-6 invalid, 4-14 options, 3-8 remote front panels, 18-15 universal constants, 5-5 patterns terminal, 7-7 PDF library, 1-1 performance disabling debugging tools, 6-10 local and global variables, 11-4 options, 3-8 phone technical support, D-1 picture controls and indicators data type (table), 5-4 using, 13-1 picture ring controls, 4-17 pictures. See graphics. pipes communication, 18-20 pixmaps, 13-4 planning projects, 7-1 plots adding to graphs and charts. See the LabVIEW Help. anti-aliased, 12-2
I-22
ni.com
Index
overlaid, 12-7 stacked, 12-7 PNG files, 13-6, 15-4 Web Server, 18-11 polar graphs, 13-2 polymorphic Expression Nodes, 21-4 functions, B-1 units, B-1 VIs, 5-16 adding instances to. See the LabVIEW Help. building, 5-17 editing shortcut menus. See the LabVIEW Help. removing instances from. See the LabVIEW Help. selecting an instance manually. See the LabVIEW Help. pop-up menus. See shortcut menus. Portable Network Graphics files, 13-6 porting VIs, 7-15 PPC Toolbox, 18-20 preferences. See options. previous versions saving VIs, 7-14 printing active window, 15-5 data from a higher level VI, 15-6 documentation of VIs, 15-3 front panel after the VI runs, 15-6 options, 3-8 programmatically, 15-6 reports, 15-7 saving documentation to HTML, 15-3 to RTF, 15-3 to text files, 15-3 techniques, 15-7 using subVIs, 15-6
Probe tool debugging VIs, 6-6 Probe tool. See probes. probes creating. See the LabVIEW Help. custom, 6-7 creating. See the LabVIEW Help. debugging VIs, 6-6 default, 6-7 Generic, 6-6 indicators, 6-7 supplied, 6-7 types of, 6-6 professional services, D-1 programming examples, D-1 program-to-program communication, 18-20 project design, 7-1 project planning, 7-1 properties ActiveX, 19-6 setting, 19-9 programmatically, 19-10 viewing, 19-9 Property Node, 17-4 ActiveX, 19-10 finding objects or terminals. See the LabVIEW Help. modifying listbox items, 4-15 protocols DataSocket, 18-3 low-level communication, 18-19 publishing VIs on Web, 18-10 pull-down menus on front panel, 4-17 purging datalog records, 14-16
Q
queues variant data, 5-22
I-23
Index
R
race conditions, 11-4 read globals, 11-3 read locals, 11-3 reading from files, 14-1 records, 14-15 deleting, 14-16 specifying while retrieving front panel data using subVIs, 14-18 refnums automation, 19-7 Call By Reference Node, 17-7 control, 17-8 controls and indicators, 4-25 data type (table), 5-4 using. See the LabVIEW Help. file I/O, 14-1 strictly typed, 17-7 registering events dynamically, 9-8 events dynamically. See the LabVIEW Help. events statically, 9-7 user events, 9-12 user events. See the LabVIEW Help. remotely calling VIs, 17-1 removing broken wires, 5-14 instances from polymorphic VIs. See the LabVIEW Help. objects on front panel or block diagram. See the LabVIEW Help. structures. See the LabVIEW Help. terminals from functions, 5-10 VIs from libraries. See the LabVIEW Help. reordering objects. See the LabVIEW Help. repeating blocks of code For Loops, 8-2
While Loops, 8-2 Repeat-Until Loops. See While Loops. replacing elements in arrays. See the LabVIEW Help. objects on block diagram. See the LabVIEW Help. objects on front panel, 4-2 text in strings. See the LabVIEW Help. reports generating, 15-7 error clusters. See the LabVIEW Help. printing, 15-7 Report Generation VIs, 15-7 resizing arrays. See the LabVIEW Help. clusters. See the LabVIEW Help. Express VIs, 7-9 front panel objects, 4-6 in relation to window size, 4-7 functions. See the LabVIEW Help. labels. See the LabVIEW Help. nodes. See the LabVIEW Help. subVIs, 7-9 tables. See the LabVIEW Help. user-defined constants, 5-6 retrieving data programmatically, 14-17 using file I/O functions, 14-18 using subVIs, 14-17 reverting to last saved versions. See the LabVIEW Help. revision history creating, 15-1 numbers, 15-2 printing, 15-3 revision number displaying in title bar. See the LabVIEW Help.
I-24
ni.com
Index
ring controls, 4-17 using. See the LabVIEW Help. rotary controls and indicators, 4-10 routing wires, 5-14 RTF saving documentation to, 15-3 rtm file, 16-2 run mode opening VIs in. See the LabVIEW Help. running VIs, 6-1 run-time menu file, 16-2
S
saving Express VI configurations as VIs, 5-19 See also the LabVIEW Help. saving files suggested location for, A-2 saving VIs for previous versions, 7-14 individual files, 7-12 libraries, 7-12 reverting to last saved versions. See the LabVIEW Help. scaling front panel objects, 4-7 graphs, 12-5 schema for XML, 10-8 scope chart, 12-7 screen resolutions, 4-30 script nodes MATLAB, 21-4 scrollbars hiding, 4-26 listboxes, 4-15 scrolling charts, 12-3 graphs, 12-3 scrolling through a chart, 12-3
searching for controls, VIs, and functions on the palettes, 3-2 PDF versions of LabVIEW documentation, 1-1 VI hierarchy. See the LabVIEW Help. selecting default instance of a polymorphic VI. See the LabVIEW Help. objects. See the LabVIEW Help. tools manually. See the LabVIEW Help. wires, 5-14 selector terminals values, 8-11 sequence local terminals, 8-14 sequence structures See also Flat Sequence structures; Stacked Sequence structures accessing values with local and global variables, 11-4 comparing Flat to Stacked, 8-13 controlling execution order, 5-26 overusing, 8-15 using. See the LabVIEW Help. servers ActiveX, 19-11 configuring for remote front panels, 18-12 LabVIEW, 18-14 Web browser, 18-14 setting cooperation level. See the LabVIEW Help. work environment options, 3-8 See also the LabVIEW Help. shared libraries building, 7-15 distributing VIs, 7-14 calling from LabVIEW, 20-1 sharing files, 7-2 live data programmatically, 18-6
I-25
Index
live data with other VIs and applications, 18-2 palette views. See the LabVIEW Help. VIs, 7-14 shift registers, 8-6 replacing with tunnels, 8-7 shortcut menus in run mode, 3-4 shortened menus, 3-3 simple menus, 3-3 single-stepping debugging VIs, 6-5 sink terminals. See indicators. sizing. See resizing. slide controls and indicators, 4-10 See also numerics. sliders adding, 4-10 smart probes. See probes. Smith plots, 13-3 smooth updates during drawing. See the LabVIEW Help. for graphs, 12-6 SMTP character sets, 18-16 transliteration, 18-18 using VIs, 18-16 snap-to grid, 4-6 software drivers, D-1 sound, 13-7 source code control, 7-2 source code. See block diagram. source terminals. See controls. space adding to front panel or block diagram, 4-9 spacing objects evenly, 4-6 See also the LabVIEW Help. speed of execution controlling, 8-10
splitting strings. See the LabVIEW Help. spreadsheet files creating, 14-8 writing numeric data to, 10-5 stacked plots, 12-7 Stacked Sequence structures, 8-13 See also sequence structures. replacing with Flat Sequence, 8-16 stacks variant data, 5-22 stand-alone applications building, 7-15 distributing VIs, 7-14 .NET, 19-5 statements. See nodes. static events registering, 9-7 static front panel images, 18-11 stepping through VIs debugging VIs, 6-5 storing work environment options, 3-8 stretching. See resizing. strict type checking, 5-23 strictly typed refnums control, 17-9 VI, 17-7 strings, 10-1 combo boxes, 4-13 comparing, C-1 controls and indicators, 4-13 data type (table), 5-3 display types, 10-2 editing programmatically, 10-3 formatting, 10-4 specifiers, 10-4 functions, 5-8 global variables, 11-5 numerics to, 10-5
I-26
ni.com
Index
polymorphism, B-5 replacing text. See the LabVIEW Help. splitting. See the LabVIEW Help. tables, 10-2 universal constants, 5-5 using format strings. See the LabVIEW Help. strip chart, 12-7 structure and support directory menus, A-2 project, A-2 resource, A-2 templates, A-2 WWW, A-2 structure of LabVIEW directories, A-1 structures, 8-1 Case, 8-11 debugging. See the LabVIEW Help. deleting. See the LabVIEW Help. Event, 9-2 Flat Sequence, 8-13 For Loops, 8-2 global variables, 11-2 local variables, 11-1 on block diagram, 2-4 removing. See the LabVIEW Help. Stacked Sequence, 8-13 using. See the LabVIEW Help. While Loops, 8-2 wiring. See the LabVIEW Help. style of controls and indicators, 16-2 subpalettes building ActiveX, 3-7 creating. See the LabVIEW Help. moving. See the LabVIEW Help. organizing, 3-6 subpanel controls, 4-19 subroutines. See subVIs.
subVIs building, 7-4 control captions for tip strips. See the LabVIEW Help. controlling behavior, 7-4 copying, A-3 creating, 7-10 situations to avoid. See the LabVIEW Help. creating from Express VIs, 5-19 See also the LabVIEW Help. designing, 7-10 determining current instance, 6-9 displaying chain of callers, 6-9 displaying names when placed. See the LabVIEW Help. expandable nodes, 7-9 front panel, 7-10 hierarchy, 7-11 icons, 7-9 polymorphic VIs, 5-16 printing data from a higher level VI, 15-6 remote front panels, 18-15 retrieving front panel data, 14-17 suspending execution, 6-9 supplied probes, 6-7 support technical, D-1 suspending execution debugging VIs, 6-9 sweep chart, 12-7 switches on front panel, 4-12 symbolic colors. See system colors. system colors, 4-29 See also the LabVIEW Help. System Exec VI, 18-20 system font, 4-27 system integration services, D-1 system-level commands, 18-20
I-27
Index
T
tab controls, 4-18 using. See the LabVIEW Help. tabbing order setting, 4-4 tabbing through front panel objects, 4-4 tables, 4-16, 10-2 using. See the LabVIEW Help. tanks See also numerics. slide controls and indicators, 4-10 TCP, 18-19 VI Server, 17-1 technical support, D-1 telephone technical support, D-1 templates creating. See the LabVIEW Help. using. See the LabVIEW Help. terminals, 2-3 adding to functions, 5-10 block diagram, 5-1 coercion dots, 5-15 conditional, 8-2 constants, 5-5 Context Help window appearance, 7-8 control and indicator (table), 5-2 count, 8-2 auto-indexing to set, 8-4 displaying, 5-2 displaying tip strips. See the LabVIEW Help. finding. See the LabVIEW Help. front panel objects and, 5-1 iteration For Loops, 8-2 While Loops, 8-3 optional, 7-8 patterns, 7-7 printing, 15-3 recommended, 7-8
removing from functions, 5-10 required, 7-8 selector, 8-11 sequence local, 8-14 wiring, 5-11 text dragging and dropping. See the LabVIEW Help. entry boxes, 4-13 finding. See the LabVIEW Help. formatting, 4-27 ring controls, 4-17 text files creating, 14-8 file I/O, 14-2 saving documentation to, 15-3 writing numeric data to, 10-5 thermometers See also numerics. slide controls and indicators, 4-10 threads running multiple. See the LabVIEW Help. time functions, 5-9 time stamp See also numerics. controls and indicators, 4-11 data types (table), 5-3 timing controlling, 8-10 tip strips control captions. See the LabVIEW Help. creating, 15-2 displaying over terminals. See the LabVIEW Help. displaying. See the LabVIEW Help. toolbar, 3-4 tools palette, 3-3 selecting manually. See the LabVIEW Help.
I-28
ni.com
Index
toolsets, 1-1 on palettes, 3-8 tracking development. See documenting VIs. training customer, D-1 transliteration emailing, 18-18 Transmission Control Protocol, 18-19 transmission lines, 13-3 transparent labels. See the LabVIEW Help. objects. See the LabVIEW Help. tree controls, 4-15 using. See the LabVIEW Help. troubleshooting resources, D-1 troubleshooting. See debugging. tunnels, 8-1 input and output, 8-12 replacing with shift registers, 8-8 type completion, 4-15 listboxes, 4-15 type controls enumerated, 4-17 advanced, 4-18 type definitions, 4-1
U
UDP, 18-19 undefined data arrays, 6-11 checking for, 6-10 Inf (infinity), 6-10 NaN (not a number), 6-10 preventing, 6-11 underflow of numbers, 6-10 undo options, 3-8 unexpected data. See default data; undefined data. ungrouping front panel objects, 4-6 unit labels, 5-23
universal constants, 5-5 unlocking Context Help window, 3-5 front panel objects, 4-6 VIs. See the LabVIEW Help. unregistering dynamic events, 9-10 user events, 9-13 updating palettes. See the LabVIEW Help. upgrading VIs, 7-14 URLs for DataSocket, 18-3 User Datagram Protocol, 18-19 user events See also the LabVIEW Help. creating, 9-12 example, 9-14 generating, 9-13 registering. See the LabVIEW Help. unregistering, 9-13 user interface. See front panel. user library adding VIs and controls, 3-6 user probes. See probes. user-defined colors. See the LabVIEW Help. user-defined constants, 5-5 user-defined error codes. See the LabVIEW Help. using format strings. See the LabVIEW Help.
V
variables global creating, 11-2 initializing, 11-4 memory, 11-5 race conditions, 11-4 read and write, 11-3 using carefully, 11-4
I-29
Index
local, 11-1 creating, 11-2 initializing, 11-4 memory, 11-5 race conditions, 11-4 read and write, 11-3 using carefully, 11-4 variant data ActiveX, 19-7 attributes, 5-23 controls and indicators data type (table), 5-4 converting to, 5-22 DataSocket, 18-9 editing attributes. See the LabVIEW Help. flattened data and, 5-23 handling, 5-22 versions comparing, 7-2 reverting to last saved. See the LabVIEW Help. saving VIs for previous, 7-14 VI object manipulating settings, 17-3 VI Server, 17-3 VI search path editing. See the LabVIEW Help. VI Server Application object, 17-3 building applications, 17-2 Call By Reference Node, 17-7 calling other instances of LabVIEW on Web, 17-1 calling VIs remotely, 17-1 capabilities, 17-1 controlling front panel objects, 17-8 Invoke Node, 17-4 manipulating VI settings, 17-3 networking and, 18-1 Property Node, 17-4 remote applications, 17-8
strictly typed VI refnums, 17-7 VI object, 17-3 viewing. See displaying. views, 3-7 changing. See the LabVIEW Help. creating, 3-6 deleting. See the LabVIEW Help. editing, 3-6 sharing. See the LabVIEW Help. virtual instruments. See VIs. VIs, 2-1 adding to libraries, 3-6 broken, 6-2 building, 7-1 calling dynamically, 17-7 calling remotely, 17-1 comparing versions, 7-2 configuring appearance and behavior, 16-1 controlling on Web, 18-10 controlling programmatically, 17-1 controlling when called as subVIs, 7-4 copying, A-3 correcting, 6-2 creating descriptions, 15-2 debugging techniques, 6-3 developing, 7-1 distributing, 7-14 documenting, 15-1 dragging and dropping. See the LabVIEW Help. error handling, 6-12 examples, 1-4 executable debugging. See the LabVIEW Help. finding. See the LabVIEW Help. hierarchy, 7-11 launching from command line. See the LabVIEW Help. libraries, 7-12 loading dynamically, 17-7
I-30
ni.com
Index
localizing, 7-15 locking. See the LabVIEW Help. marking as top-level in libraries. See the LabVIEW Help. naming, 7-13 opening in run mode. See the LabVIEW Help. polymorphic, 5-16 porting, 7-15 printing, 15-5 publishing on Web, 18-10 reference. See the LabVIEW Help. removing from libraries. See the LabVIEW Help. reverting to last saved versions. See the LabVIEW Help. running, 6-1 saving, 7-12 sharing, 7-14 strictly typed refnums, 17-7 unlocking. See the LabVIEW Help. upgrading, 7-14 VISA passing resource names, 4-20 VXI configuring, 1-4 VIs, 1-3
W
warnings button, 6-2 displaying, 6-2 displaying by default. See the LabVIEW Help. waveform charts, 12-11 controls and indicators data type (table), 5-4 data type, 12-18 functions, 5-9
graphs, 12-8 data types, 12-9 graphics, 13-3 waveforms reading from files, 14-10 writing to files, 14-10 weakly typed control references, 17-9 Web calling other instances of LabVIEW, 17-1 controlling VIs, 18-12 creating HTML documents, 18-11 professional services, D-1 publishing VIs, 18-10 technical support, D-1 viewing front panels, 18-12 Web Publishing Tool, 18-11 Web Server clients for remote front panels LabVIEW, 18-13 multiple, 18-12 Web browser, 18-14 controlling VIs, 18-12 enabling, 18-10 licenses for serving remote front panels, 18-12 options, 18-10 viewing front panels, 18-12 While Loops auto-indexing, 8-5 conditional terminals, 8-2 controlling timing, 8-10 error handling, 6-14 infinite, 8-3 iteration terminals, 8-3 shift registers, 8-6 using. See the LabVIEW Help. window size defining. See the LabVIEW Help. window titles in Functions palette. See the LabVIEW Help.
I-31
Index
wires, 2-4 broken, 5-14 moving. See the LabVIEW Help. routing, 5-14 selecting, 5-14 wiring automatically, 5-12 guides. See the LabVIEW Help. manually, 5-11, 5-13 structures. See the LabVIEW Help. techniques, 5-28 tool, 5-13 units, 5-23 wiring manually on block diagram, 5-13 work environment options setting, 3-8 See also the LabVIEW Help. storing, 3-8 worldwide technical support, D-1 write globals, 11-3 write locals, 11-3 writing to files, 14-1
X
XML converting data types to, 10-7 converting from, 10-7 example, 10-5 schema, 10-8 x-scales multiple, 12-2 XY graphs, 12-8 data types, 12-10, 12-11
Y
y-scales multiple, 12-2
Z
zooming on graphs and charts. See the LabVIEW Help.
I-32
ni.com