You are on page 1of 30

Welcome to the LabVIEW Development Days 2010 presentation, Tips and Tricks to Speed LabVIEW Development.

This presentation was created by Darren Nattinger, Senior Software Engineer, LabVIEW R&D and Kelly Rink, Applications Engineer, Applications Engineering Department.

Tips and Tricks to Speed LabVIEW Development


This presentation will cover 25 “nuggets” of information designed to reduce programming effort in LabVIEW and improve development time. The tips and tricks range from simple reminders of useful LabVIEW features, to advanced functions and tools. Hopefully, everyone will come out of the presentation with some new useful tricks to apply in their everyday programming.

Tips and Tricks to Speed LabVIEW Development


The Auto Tool can be found on top of the Tools Palette located under View >> Tools Palette. Though most LabVIEW users are aware of this feature (it is turned on by default), many users still use the Tab key to manually switch tools. Let this slide pose a challenge: try the Auto Tool for 30 days; the vast majority of LabVIEW programmers will find that the Auto Tool greatly speeds their development after a little practice.

Tips and Tricks to Speed LabVIEW Development


It is launched by pressing Ctrl-Space. Tips and Tricks to Speed LabVIEW Development 4 . you can use Ctrl-Space-Ctrl-T to move control and indicator terminal labels to the left and right sides of the terminals. You can use Ctrl-SpaceCtrl-R to remove one or more diagram objects and wire up pass-through terminals of matching data types. three keyboard shortcuts were added to Quick Drop. In LabVIEW 2009. Quick Drop eliminates the need to navigate through the palettes to find objects.The Quick Drop dialog box can be used to specify a palette object or project item by name and then place the object on the block diagram or front panel. Lastly. You can select one or more objects on the block diagram and Press Ctrl-Space-Ctrl-D to create controls and indicators for all unwired terminals.

The templates can be accessed through the File New… menu. Templates consist of well known designs such as Producer/Consumer. and Queued Message Handler patterns. State Machine. Tips and Tricks to Speed LabVIEW Development 5 .Using design pattern templates will greatly decrease development and maintenance time of a project.

it can be easy to accidentally connect each wire to the wrong input. Use the “switcheroo” tool to automatically swap the wire connections. In addition. Note: the “switcheroo” tool only works for functions with two inputs when both inputs have already been wired. Tips and Tricks to Speed LabVIEW Development 6 . this tool only works when using the Auto Tool or Wiring Tool.When connecting wires to a function like subtract or divide. just hold down Ctrl and left click on one of the input terminals.

event structure. or stacked sequence structure.Sometimes it can be difficult or time-consuming to scroll through a multi-frame structure such as a case structure. you can quickly flip through frames of these structures without having to click repetitively. By holding down the Ctrl key and scrolling the mouse wheel. Tips and Tricks to Speed LabVIEW Development 7 .

To quickly navigate to the same palette (or a related palette) as an object that you have already placed. it is common to place several objects from the same palette on the block diagram. right click on the object and select one of the available palette shortcuts. Note: you can also place frequently used objects on the Favorites palette. Tips and Tricks to Speed LabVIEW Development 8 . simply right click on a given object in its usual palette location and select Add Item to Favorites.When performing a specific task (such as File I/O).

There are both vertical and horizontal scrollbars. you can easily view the last element of an array by selecting Advanced >> Show Last Element after right clicking on an array. To scroll through array elements much faster. depending on how you are viewing your array. right click on the array and choose Visible Items >> Horizontal <or Vertical> Scrollbar. In addition.Many LabVIEW users click on the array index control to (slowly) view array elements. Tips and Tricks to Speed LabVIEW Development 9 .

Tips and Tricks to Speed LabVIEW Development 10 . your wire will be connected to the lower terminal of the object. If you rightclick slightly above the wire. and if you right-click slightly below the wire. Position is important for this tip.You can insert an object onto an existing wire by right-clicking slightly above or below the wire and selecting Insert. the wire will be connected to the upper terminal of the object.

rerouting and straightening wires. then you can wrap it in a singleframe Flat Sequence Structure and then choose the cleanup exclusion option on that structure.6 introduced the block diagram clean-up feature to “straighten up” your block diagram by rearranging and aligning controls and indicators.LabVIEW 8. but it doesn't have a containing structure. This feature was enhanced in LabVIEW 2009 by allowing you to cleanup a selected portion of your block diagram and exclude a section of your code from any cleanup operations. or exclude diagram structures from clean up by right clicking them and selecting "Exclude from Diagram Cleanup“. etc… You can access this feature by clicking the clean-up button on the tool bar or by pressing Ctrl-U. Tips and Tricks to Speed LabVIEW Development 11 . If there is a section of code that you want to keep clean. You can highlight a section of your code to only clean up that section.

One situation where this option is especially helpful is adding a new pass-through wire to an existing case structure or event structure that has multiple frames.To automatically link tunnels. right-click an output tunnel and select Linked Input Tunnel > Create & Wire Unwired Cases. Linked tunnels are denoted by a white triangle on the edge of the input and output tunnels. Tips and Tricks to Speed LabVIEW Development 12 . Another situation is adding a new frame to an existing case or event structure that already has linked tunnels.

which returns the number of rows and columns of the array directly. you needed to use the Array Size function and an Index Array function to determine the number of rows and columns in a 2D array. Tips and Tricks to Speed LabVIEW Development 13 . LabVIEW 2009 introduced the Matrix Size function. regardless of the data type of the array.Prior to LabVIEW 2009.

disable. You can launch the Breakpoint Manager by going to View » Breakpoint Manager or by right clicking a diagram object and selecting Breakpoint » Breakpoint Manager. and clear any breakpoints set on VIs in memory. enable.The Breakpoint Manager in LabVIEW 8. Tips and Tricks to Speed LabVIEW Development 14 .6 and later allows you to view.

Pressing Ctrl-Shift-E from an open VI. Tips and Tricks to Speed LabVIEW Development 15 . while its corresponding project is open will highlight the location of the VI in its owning project.

Tips and Tricks to Speed LabVIEW Development 16 . A much faster way to add enumeration items is to first press Ctrl while hovering over an Enum in order to change to the Edit Text Tool.The most common way to add or modify items in an enumeration is to right click on the Enum and select Edit Items. then use Shift + Enter to add multiple items. click in the enum to start editing text. This method also works for Rings.

and then building a new path by appending a new VI name to the stripped path.LabVIEW users frequently need to open a VI reference for a VI that is next to the current file on disk. and then using the “…\Other_VI” format for building the final path. This slide shows several methods for doing this. Most users are not aware that a VI name can be passed directly into the Open VI Reference function. the first method requires stripping down the current VI’s path. this is a lot easier than the previous two methods! It should also be noted that a subVI can be called dynamically simply by right clicking on that VI and selecting Call Setup. A slightly better way to accomplish the same task is wiring the current VI’s path directly into the Build Path function. Tips and Tricks to Speed LabVIEW Development 17 . which will locate the VI in the current VI’s directory.

Highlighting multiple front panel or block diagram objects and navigating to their properties menu will allow you to modify all properties that overlap between the selected items. This can be a significant time saving feature. Block diagram constants are one of the few object types you can configure with the Properties dialog. The property list is much more limited for block diagram items. especially when working with similar front panel objects that share properties. Tips and Tricks to Speed LabVIEW Development 18 .

It is easy to create a class-specific. Simply drag a front panel control into a control Refnum to create a correspondingly typed reference. Tips and Tricks to Speed LabVIEW Development 19 . type-specific control reference in LabVIEW without right clicking on a control reference and navigating through several menus. this tip can save a lot of work. especially when dealing with a class that can have more than one data type associated with it.

an Internet Explorer URL can be dragged into a string constant to reduce typing. you can select any file (from your disk or desktop) and drag it directly into a path constant to automatically fill it in. Tips and Tricks to Speed LabVIEW Development 20 . One great way to improve efficiency while working with a LabVIEW project is to drag items (such as VIs and Classes) from disk or the Project Explorer window directly onto the LabVIEW block diagram. For example. In addition. This will automatically create an icon for your LabVIEW application by resizing your image.Dragging and dropping items in LabVIEW is often overlooked. Likewise. this tip can greatly reduce development time. try dragging an image file directly into your front panel icon.

there is an easy way to relink all the subVIs in a single operation. All found instances of the subVI will become relinked. pick the subVI itself in the "Replace With" box. and this subVI is called in several places. Tips and Tricks to Speed LabVIEW Development 21 .If a subVI requires relinking in your application. and then select the "Replace All" button. Then. First you find all instances of the subVI in the Find dialog.

Examples of plugins include Justify Text. called Right-Click Plugins.The JKI Right-Click Framework for LabVIEW allows you to add editor features to custom right-click menus. These new features. can be created by any member of the LabVIEW community. Wire Error Case Structure. Tips and Tricks to Speed LabVIEW Development 22 . This framework makes commonly used editor actions just a right-click away. and Insert Bundle by Name. Create Enum from String.

use the search feature.g. You can even drag and drop a property or method onto the block diagram in order to automatically create a property node or invoke node! Tips and Tricks to Speed LabVIEW Development 23 .Instead of browsing through several property nodes in order to (hopefully) find a certain property. Inside the Class Browser. DAQmx. To search for a specific property. use the Class Browser. you can select an Object Library (such as VI Server. Application or DAQmx Channel) to quickly view all available properties and methods. or VISA) and a Class (e. This can be easily accessed by pressing Ctrl + Shift + B.

This functionality has been around for a long time. and there are even some private VI Server properties that help you determine the VI from which the menu option was selected.One helpful LabVIEW feature that add-on developers frequently use is placing VIs in the [LabVIEW]\project folder to create new entries in the Tools menu. Tips and Tricks to Speed LabVIEW Development 24 .lib\VIServer\Menu Launch VI Information. In LabVIEW 2009 and later. you can use [LabVIEW]\vi. You can then wire these items to an Open VI Reference function to gain access to the VI from which the menu item was selected. along with the VI to get the App reference of the owning app for the VI from which the menu item was selected. You can also place VIs in the [LabVIEW]\help folder to have them appear in the Help menu and in the [LabVIEW]\wizard folder to have them appear in the File menu.

and get the extension of a file path without having to convert the path to a string and parse out the information.2 and later. The Check if File or Folder Exists and Get File Extension VIs are fairly self explanatory. and MD5 Checksum File will compute the MD5 message-digest of a file. they provide quick ways to see if a file is present on disk. Generate Temporary File Path can automatically create unique file path in the temporary directory. To see the common path between two files (or obtain the relative path from one file to the next). Use the Recursive File List VI to automatically obtain a listing of files and folders in a directory or LLB.Several VIs are available in the Advanced File I/O palette in LabVIEW 8. use the Compare Two Paths function. Finally. Tips and Tricks to Speed LabVIEW Development 25 . this is a great way to assure users that the program did not hang! Tips and Tricks to Speed LabVIEW Development 26 . This VI automatically opens up a progress indicator if the For Loop it is placed in takes longer than a specified amount of time to sample VI for implementing the For Loop progress bar is located as an attachment on (

The VI Analyzer is a LabVIEW toolkit that allows you to check your code’s performance. user interface (UI). and several other areas. Tips and Tricks to Speed LabVIEW Development 27 . The VI Analyzer can quickly identify programming mistakes that would have taken hours to locate manually. You can also save VI Analyzer settings for later use. documentation.

Feedback Nodes only appear if you actually drop them down. You may not need 99.8 undo steps is the default value.This is the option you must select if you want Quick Drop to be immediately usable after launching LabVIEW. •Block Diagram > General > Auto-insert Feedback Node in cycles: UNCHECKED – Often Feedback Nodes magically appear while wiring. •Controls/Functions Palettes > Loading > Load palettes during launch . when we do not want them there. •Environment > General > Maximum undo steps per VI: 99 . •Environment > General > Skip Getting Started window on launch: CHECKED –Makes up some launch time speed lost with the Load palettes during launch selection. Tips and Tricks to Speed LabVIEW Development 28 . •Environment > Saving VIs > Enable automatic saving for recovery: CHECKED – For unexpected crashes and hangs so you do not lose everything. but you often need more than 8. With this option unchecked. •Block Diagram > Wiring > Enable auto wiring: CHECKED . •Source Control: ENABLED –e.Gets the wiring right 95% of the time.g. really handy to be able to check in/out VIs directly from the LabVIEW project window. for perforce. Press the spacebar the other 5% of the time to drop the object without auto wiring.•Front Panel > General > Connector pane terminals default to Required: CHECKED – Saves debugging time used to discover instances where terminals on a subVI are accidentally left unwired.

Tips and Tricks to Speed LabVIEW Development 29 .

Tips and Tricks to Speed LabVIEW Development 30 .Thank you for attending the Tips and Tricks to Speed LabVIEW Development session. Questions are welcome at this time.