文档库 最新最全的文档下载
当前位置:文档库 › 提高Labview开发速度25技巧

提高Labview开发速度25技巧

LabVIEW开发技术丛书提高LabVIEW开发速度25技

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.

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.

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.

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. It is launched by pressing Ctrl-Space.Quick Drop eliminates the need to navigate through the palettes to find objects.

In LabVIEW 2009, three keyboard shortcuts were added to Quick Drop. 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. You can use Ctrl-Space-Ctrl-R to remove one or more diagram objects and wire up pass-through terminals of matching data types. Lastly, you can use Ctrl-Space-Ctrl-T to move control and indicator terminal labels to the left and right sides of the terminals.

Using design pattern templates will greatly decrease development and maintenance time of a project. Templates consist of well known designs such as

Producer/Consumer, State Machine, and Queued Message Handler patterns. The templates can be accessed through the File ?New…menu.

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

Sometimes it can be difficult or time-consuming to scroll through a multi-frame structure 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 flip through frames of these structures without having to click repetitively.

When performing a specific task (such as File I/O), it is common to place several objects from the same palette on the block diagram. To quickly navigate to the same palette (or a related palette) as an object that you have already placed, 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; simply right click on a given object in its usual palette location and select Add Item to Favorites.

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

You can insert an object onto an existing wire by right-clicking slightly above or below 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 the object, and if you right-click slightly below the wire, the wire will be connected to the upper terminal of the object.

LabVIEW 8.6 introduced the block diagram clean-up feature to “straighten up” your block diagram by rearranging and aligning controls and indicators, rerouting and straightening wires, etc… You can access this feature by clicking the clean-up button on the tool bar or by pressing Ctrl-U.

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. You can highlight a section of your code to only clean up that section, or exclude diagram structures from clean up by right clicking them and selecting "Exclude from Diagram Cleanup“.If there is a section of code that you want to keep clean, but it doesn't have a containing structure, then you can wrap it in a single-frame Flat Sequence Structure and then choose the cleanup exclusion option on that structure.

To automatically link tunnels, right-click an output tunnel and select Linked Input Tunnel > Create & Wire Unwired Cases. 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. Another situation is adding a new frame to an 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.

Prior to LabVIEW 2009, 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. LabVIEW 2009 introduced the Matrix Size function, which returns the number of rows and columns of the array directly, regardless of the data type of the array.

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 the Breakpoint Manager by going to View ? Breakpoint Manager or by right clicking a diagram object and selecting Breakpoint ? Breakpoint Manager.

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

The most common way to add or modify items in an enumeration is to right click on the Enum and select Edit Items. 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, click in the enum to start editing text, then use Shift + Enter to add multiple items. This method also works for Rings.

LabVIEW users frequently need to open a VI reference for a VI that is next to the current file on disk. This slide shows several methods for doing this; the first method requires stripping down the current VI’s path, and then building a new path by appending a new VI name to the stripped path. A slightly better way to accomplish the same task is wiring the current VI’s path directly into the Build Path function, and then using the “…\Other_VI” format for building the final path. Most users are not aware that a VI name can be passed directly into the Open VI Reference function, which will locate the VI in the current VI’s directory; 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.

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, especially when working with similar front panel objects that share properties. The property list is much more limited for block diagram items. Block diagram constants are one of the few object types you can configure with the Properties dialog.

It is easy to create a class-specific, type-specific control reference in LabVIEW without right clicking on a control reference and navigating through several menus. Simply drag a front panel control into a control Refnum to create a correspondingly typed reference; 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.

相关文档
相关文档 最新文档