3 Speed Up Labview Development

download 3 Speed Up Labview Development

of 30

Transcript of 3 Speed Up Labview Development

  • 8/2/2019 3 Speed Up Labview Development

    1/30

    Welcome to the LabVIEW Development Days 2010 presentation, Tips andTricks to Speed LabVIEW Development. This presentation was created byDarren Nattinger, Senior Software Engineer, LabVIEW R&D and Kelly Rink,Applications Engineer, Applications Engineering Department.

    Tips and Tricks to Speed LabVIEW Development 1

  • 8/2/2019 3 Speed Up Labview Development

    2/30

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

    Tips and Tricks to Speed LabVIEW Development 2

  • 8/2/2019 3 Speed Up Labview Development

    3/30

    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 turnedon by default), many users still use the Tab key to manually switch tools. Let thisslide pose a challenge: try the Auto Tool for 30 days; the vast majority of LabVIEWprogrammers will find that the Auto Tool greatly speeds their development after a

    little practice.

    Tips and Tricks to Speed LabVIEW Development 3

  • 8/2/2019 3 Speed Up Labview Development

    4/30

    The Quick Drop dialog box can be used to specify a palette object or project item byname and then place the object on the block diagram or front panel. It is launchedby pressing Ctrl-Space. Quick Drop eliminates the need to navigate through thepalettes to find objects.

    In LabVIEW 2009, three keyboard shortcuts were added to Quick Drop. You canselect one or more objects on the block diagram and Press Ctrl-Space-Ctrl-D tocreate controls and indicators for all unwired terminals. You can use Ctrl-Space-Ctrl-R to remove one or more diagram objects and wire up pass-through terminalsof matching data types. Lastly, you can use Ctrl-Space-Ctrl-T to move control andindicator terminal labels to the left and right sides of the terminals.

    Tips and Tricks to Speed LabVIEW Development 4

  • 8/2/2019 3 Speed Up Labview Development

    5/30

    Using design pattern templates will greatly decrease development and maintenancetime of a project. Templates consist of well known designs such asProducer/Consumer, State Machine, and Queued Message Handler patterns. Thetemplates can be accessed through the File New menu.

    Tips and Tricks to Speed LabVIEW Development 5

  • 8/2/2019 3 Speed Up Labview Development

    6/30

    When connecting wires to a function like subtract or divide, it can be easy toaccidentally connect each wire to the wrong input. Use the switcheroo tool toautomatically swap the wire connections; just hold down Ctrl and left click on oneof the input terminals. Note: the switcheroo tool only works for functions with twoinputs when both inputs have already been wired. In addition, this tool only works

    when using the Auto Tool or Wiring Tool.

    Tips and Tricks to Speed LabVIEW Development 6

  • 8/2/2019 3 Speed Up Labview Development

    7/30

    Sometimes it can be difficult or time-consuming to scroll through a multi-framestructure such as a case structure, event structure, or stacked sequence structure.By holding down the Ctrl key and scrolling the mouse wheel, you can quickly flipthrough frames of these structures without having to click repetitively.

    Tips and Tricks to Speed LabVIEW Development 7

  • 8/2/2019 3 Speed Up Labview Development

    8/30

    When performing a specific task (such as File I/O), it is common to place severalobjects from the same palette on the block diagram. To quickly navigate to the samepalette (or a related palette) as an object that you have already placed, right click onthe object and select one of the available palette shortcuts. Note: you can alsoplace frequently used objects on the Favorites palette; simply right click on a given

    object in its usual palette location and select Add Item to Favorites.

    Tips and Tricks to Speed LabVIEW Development 8

  • 8/2/2019 3 Speed Up Labview Development

    9/30

    Many LabVIEW users click on the array index control to (slowly) view arrayelements. To scroll through array elements much faster, right click on the array andchoose Visible Items >> Horizontal Scrollbar. In addition, you caneasily view the last element of an array by selecting Advanced >> Show LastElement after right clicking on an array. There are both vertical and horizontal

    scrollbars, depending on how you are viewing your array.

    Tips and Tricks to Speed LabVIEW Development 9

  • 8/2/2019 3 Speed Up Labview Development

    10/30

    You can insert an object onto an existing wire by right-clicking slightly above orbelow the wire and selecting Insert. Position is important for this tip. If you right-click slightly above the wire, your wire will be connected to the lower terminal of theobject, and if you right-click slightly below the wire, the wire will be connected to theupper terminal of the object.

    Tips and Tricks to Speed LabVIEW Development 10

  • 8/2/2019 3 Speed Up Labview Development

    11/30

  • 8/2/2019 3 Speed Up Labview Development

    12/30

    To automatically link tunnels, right-click an output tunnel and select Linked InputTunnel > Create & Wire Unwired Cases. One situation where this option isespecially helpful is adding a new pass-through wire to an existing case structure orevent structure that has multiple frames. Another situation is adding a new frame toan existing case or event structure that already has linked tunnels. 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

  • 8/2/2019 3 Speed Up Labview Development

    13/30

    Prior to LabVIEW 2009, you needed to use the Array Size function and an IndexArray function to determine the number of rows and columns in a 2D array.LabVIEW 2009 introduced the Matrix Size function, which returns the number ofrows and columns of the array directly, regardless of the data type of the array.

    Tips and Tricks to Speed LabVIEW Development 13

  • 8/2/2019 3 Speed Up Labview Development

    14/30

    The Breakpoint Manager in LabVIEW 8.6 and later allows you to view, enable,disable, and clear any breakpoints set on VIs in memory. You can launch theBreakpoint Manager by going to View Breakpoint Manager or by right clicking adiagram object and selecting Breakpoint Breakpoint Manager.

    Tips and Tricks to Speed LabVIEW Development 14

  • 8/2/2019 3 Speed Up Labview Development

    15/30

    Pressing Ctrl-Shift-E from an open VI, while its corresponding project is open willhighlight the location of the VI in its owning project.

    Tips and Tricks to Speed LabVIEW Development 15

  • 8/2/2019 3 Speed Up Labview Development

    16/30

    The most common way to add or modify items in an enumeration is to right click onthe Enum and select Edit Items. A much faster way to add enumeration items is tofirst press Ctrl while hovering over an Enum in order to change to the Edit TextTool, click in the enum to start editing text, then use Shift + Enter to add multipleitems. This method also works for Rings.

    Tips and Tricks to Speed LabVIEW Development 16

  • 8/2/2019 3 Speed Up Labview Development

    17/30

    LabVIEW users frequently need to open a VI reference for a VI that is next to thecurrent file on disk. This slide shows several methods for doing this; the first methodrequires stripping down the current VIs path, and then building a new path byappending a new VI name to the stripped path. A slightly better way to accomplishthe same task is wiring the current VIs path directly into the Build Path function,

    and then using the \Other_VI format for building the final path. Most users arenot aware that a VI name can be passed directly into the Open VI Referencefunction, which will locate the VI in the current VIs directory; this is a lot easier thanthe previous two methods! It should also be noted that a subVI can be calleddynamically simply by right clicking on that VI and selecting Call Setup.

    Tips and Tricks to Speed LabVIEW Development 17

  • 8/2/2019 3 Speed Up Labview Development

    18/30

    Highlighting multiple front panel or block diagram objects and navigating to theirproperties menu will allow you to modify all properties that overlap between theselected items. This can be a significant time saving feature, especially whenworking with similar front panel objects that share properties. The property list ismuch more limited for block diagram items. Block diagram constants are one of the

    few object types you can configure with the Properties dialog.

    Tips and Tricks to Speed LabVIEW Development 18

  • 8/2/2019 3 Speed Up Labview Development

    19/30

    It is easy to create a class-specific, type-specific control reference in LabVIEWwithout right clicking on a control reference and navigating through several menus.Simply drag a front panel control into a control Refnum to create a correspondinglytyped reference; this tip can save a lot of work, especially when dealing with a classthat can have more than one data type associated with it.

    Tips and Tricks to Speed LabVIEW Development 19

  • 8/2/2019 3 Speed Up Labview Development

    20/30

    Dragging and dropping items in LabVIEW is often overlooked; this tip can greatlyreduce development time. For example, try dragging an image file directly into yourfront panel icon. This will automatically create an icon for your LabVIEW applicationby resizing your image. In addition, you can select any file (from your disk ordesktop) and drag it directly into a path constant to automatically fill it in. Likewise,

    an Internet Explorer URL can be dragged into a string constant to reduce typing.One great way to improve efficiency while working with a LabVIEW project is todrag items (such as VIs and Classes) from disk or the Project Explorer windowdirectly onto the LabVIEW block diagram.

    Tips and Tricks to Speed LabVIEW Development 20

  • 8/2/2019 3 Speed Up Labview Development

    21/30

    If a subVI requires relinking in your application, and this subVI is called in severalplaces, there is an easy way to relink all the subVIs in a single operation. First youfind all instances of the subVI in the Finddialog. Then, pick the subVI itself in the"Replace With" box, and then select the "Replace All" button. All found instances ofthe subVI will become relinked.

    Tips and Tricks to Speed LabVIEW Development 21

  • 8/2/2019 3 Speed Up Labview Development

    22/30

    The JKI Right-Click Framework for LabVIEW allows you to add editor features tocustom right-click menus. These new features, called Right-Click Plugins, can becreated by any member of the LabVIEW community. Examples of plugins includeJustify Text, Wire Error Case Structure, Create Enum from String, and Insert Bundleby Name. This framework makes commonly used editor actions just a right-click

    away.

    Tips and Tricks to Speed LabVIEW Development 22

  • 8/2/2019 3 Speed Up Labview Development

    23/30

    Instead of browsing through several property nodes in order to (hopefully) find acertain property, use the Class Browser. This can be easily accessed by pressingCtrl + Shift + B. Inside the Class Browser, you can select an Object Library(such as VI Server, DAQmx, or VISA) and a Class (e.g. Application or DAQmxChannel) to quickly view all available properties and methods. To search for a

    specific property, use the search feature. You can even drag and drop a property ormethod onto the block diagram in order to automatically create a property node orinvoke node!

    Tips and Tricks to Speed LabVIEW Development 23

  • 8/2/2019 3 Speed Up Labview Development

    24/30

    One helpful LabVIEW feature that add-on developers frequently use is placing VIsin the [LabVIEW]\project folder to create new entries in the Toolsmenu. You canalso place VIs in the [LabVIEW]\helpfolder to have them appear in the Helpmenuand in the [LabVIEW]\wizardfolder to have them appear in the Filemenu.

    This functionality has been around for a long time, and there are even some privateVI Server properties that help you determine the VI from which the menu option wasselected. In LabVIEW 2009 and later, you can use [LabVIEW]\vi.lib\VIServer\MenuLaunch VI Information.vi to get the App reference of the owning app for the VI fromwhich the menu item was selected, along with the VI name. You can then wirethese items to an Open VI Reference function to gain access to the VI from whichthe menu item was selected.

    Tips and Tricks to Speed LabVIEW Development 24

  • 8/2/2019 3 Speed Up Labview Development

    25/30

    Several VIs are available in the Advanced File I/O palette in LabVIEW 8.2 andlater. Use the Recursive File List VI to automatically obtain a listing of files andfolders in a directory or LLB. The Check if File or Folder Exists and Get FileExtension VIs are fairly self explanatory; they provide quick ways to see if a file ispresent on disk, and get the extension of a file path without having to convert the

    path to a string and parse out the information. To see the common path betweentwo files (or obtain the relative path from one file to the next), use the CompareTwo Paths function. Finally, Generate Temporary File Path can automaticallycreate unique file path in the temporary directory, and MD5 Checksum File willcompute the MD5 message-digest of a file.

    Tips and Tricks to Speed LabVIEW Development 25

  • 8/2/2019 3 Speed Up Labview Development

    26/30

    A sample VI for implementing the For Loop progress bar is located as anattachment on(http://forums.ni.com/ni/board/message?board.id=170&message.id=192115). ThisVI automatically opens up a progress indicator if the For Loop it is placed in takeslonger than a specified amount of time to complete; this is a great way to assure

    users that the program did not hang!

    Tips and Tricks to Speed LabVIEW Development 26

  • 8/2/2019 3 Speed Up Labview Development

    27/30

    The VI Analyzer is a LabVIEW toolkit that allows you to check your codesperformance, user interface (UI), documentation, and several other areas. The VIAnalyzer can quickly identify programming mistakes that would have taken hours tolocate manually. You can also save VI Analyzer settings for later use.

    Tips and Tricks to Speed LabVIEW Development 27

  • 8/2/2019 3 Speed Up Labview Development

    28/30

    Front Panel > General > Connector pane terminals default to Required: CHECKED Saves debugging time used to discover instances where terminals on a subVI areaccidentally left unwired.

    Block Diagram > General > Auto-insert Feedback Node in cycles: UNCHECKEDOften Feedback Nodes magically appear while wiring, when we do not want themthere. With this option unchecked, Feedback Nodes only appear if you actually drop them

    down.Block Diagram > Wiring > Enable auto wiring: CHECKED - Gets the wiring right 95% ofthe time; Press the spacebar the other 5% of the time to drop the object without auto wiring.

    Controls/Functions Palettes > Loading > Load palettes during launch - This is theoption you must select if you want Quick Drop to be immediately usable after launchingLabVIEW.

    Environment > General > Skip Getting Started window on launch: CHECKED Makesup some launch time speed lost with the Load palettes during launch selection.

    Environment > General > Maximum undo steps per VI: 99 - 8 undo steps is the defaultvalue. You may not need 99, but you often need more than 8.

    Environment > Saving VIs > Enable automatic saving for recovery: CHECKED Forunexpected crashes and hangs so you do not lose everything.

    Source Control: ENABLEDe.g. for perforce; really handy to be able to check in/out VIsdirectly from the LabVIEW project window.

    Tips and Tricks to Speed LabVIEW Development 28

  • 8/2/2019 3 Speed Up Labview Development

    29/30

    Tips and Tricks to Speed LabVIEW Development 29

  • 8/2/2019 3 Speed Up Labview Development

    30/30

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