Lesson 1 Introduction to LabVIEW TOPICS LabVIEW Environment Front Panel Block Diagram Dataflow Programming LabVIEW Help and Manuals Debugging a VI 1
Virtual Instruments (VIs) Front Panel Controls = Inputs Indicators = Outputs Block Diagram Accompanying program for front panel Components wired together 2
LabVIEW Dialog Box 3
Creating a new VI File»New VI to open a blank VI File»New to open the New dialog box and configure a VI template, global variable, control, etc 4
Template Browser 5
Menu File Edit Operate Tools Browse Window Help 6
Front Panel Window Front Panel Toolbar Boolean Control Waveform Graph Owned Label Icon Graph Legend Waveform Graph Plot Legend Scale Legend 7
Block Diagram Window Block Diagram Toolbar Divide Function SubVI Graph Terminal Wire Data While Loop Structure Numeric Constant Timing Function Boolean Control Terminal 8
Front Panel and Block Diagram Toolbars Run button Continuous Run button Abort button Pause/Continue button Warning indicator Enter button Broken Run button Additional Buttons on the Reorder ring Block Diagram Toolbar Context Help Button Execution Highlighting button Step Into button Step Over button Step Out button Font ring Alignment ring Distribution ring Resize ring 9
Tools Palette LabVIEW automatically selects the tool needed Available on the front panel and the block diagram A tool is a special operating mode of the mouse cursor Use the tools to operate and modify front panel and block diagram objects To show the tools palette, select Window»Show Tools Palette 10
Front Panel Controls Palette Controls Palette Contains the most commonly used controls All Controls Palette Shows all controls 11
Block Diagram Functions Palette Functions Palette Contains the Express VIs (interactive VIs with configurable dialog page) and the most commonly used functions All Functions Palette Shows all functions 12
Palette Tools Click pushpin to tack down palette Up to Owning Palette Search Palette Options Graphical, floating palettes Subpalettes can be converted to floating palettes Use Palette Options to change palette view from Express to Advanced 13
Searching for Controls, VIs, and Functions Press the search button to perform text searches of the palettes Click and drag an item from the search window to the block diagram or double-click an item to open the owning palette 14
Customize Control & Function Palette Programs» National Instruments»LabVIEW 7.0 Keep vi.lib in the LabVIEW 7.0 directory Place items in user.lib or instr.lib to have them appear in the Controls and Functions palettes 15
Creating a VI Front Panel Build the front panel with controls (inputs) and indicators (outputs) Owned Labels Numeric Indicator Boolean Control Boolean Indicator Increment Buttons Numeric Control 16
Shortcut Menus for Front Panel Objects Right-click the label to access its shortcut menu Right-click the digital display to access its shortcut menu 17
Property Page 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 18
Creating a VI Block Diagram Front Panel Control Terminals Block Diagram Indicator Terminals Wires Nodes 19
Express VIs, VIs and Functions Express VIs: interactive VIs with configurable dialog page Standard VIs: modularized VIs customized by wiring Functions: fundamental operating elements of LabVIEW; no front panel or block diagram 20
Block Diagram Nodes Icon Expandable Node Expanded Node Function Generator VI Same VI, viewed three different ways Yellow field designates a standard VI Blue field designates an Express VI 21
Block Diagram Terminals Terminals are entry and exit ports that exchange information between the panel and diagram Terminals are analogous to parameters and constants in textbased programming languages Right-click and toggle View As Icon to change the icon view 22
Wiring the Block Diagram Scalar 1D Array 2D Array Numeric Boolean String Dynamic 23
Wiring Techniques Automatic Wiring Use Context Help Window when wiring Right-click wire and select Clean Up Wire Tip Strips Automatic wire routing Right-click terminals and select Visible Items»Terminals Hot Spot View the terminal connections to a function 24
Dataflow Programming Block diagram executes dependent on the flow of data; block diagram does NOT execute left to right Node executes when data is available to ALL input terminals Nodes supply data to all output terminals when done 25
Context Help To display the Context Help window, select Help»Show Context Help, press the <Ctrl-H> keys, or press the Show Context Help Window button in the toolbar Move cursor over object to display help Connections: Required bold Recommended normal Optional - dimmed Simple/Detailed Context Help Lock Help More Help 26
LabVIEW Help Click the More Help button in the Context Help window Select Help»VI, Function, & How-To Help Click the sentence Click here for more help in the Context Help window. Contains detailed descriptions of most palettes, menus, tools, VIs, and functions, step-by-step instructions for using LabVIEW features, links to the LabVIEW Tutorial, PDF versions of all the LabVIEW manuals and Application Notes, and technical support resources. 27
NI Example Finder To find an example, select Help»Find Examples Web-integrated Search by keyword, example type, hardware type, etc. 28
Debugging Techniques Finding Errors Execution Highlighting Click on broken Run button. A window showing the error appears Click on Execution Highlighting button; data flow is animated using bubbles. Values are displayed on wires. 29
Debugging Techniques Probe Breakpoints Conditional Probe Right-click on wire and select probe and it shows data as it flows through the wire segment Right-click on wire and select Set Breakpoint; pause execution at the breakpoint. Combination of a breakpoint and a probe. Right-click on wire and select custom probe. 30
Debugging Techniques Step Into, Over, and Out buttons for Single Stepping Click on Step Into button to enable single stepping Once Single Stepping has begun, the button steps into nodes Click on Step Over button to enable single stepping or to step over nodes Click on Step Out button to step out of nodes 31
Summary Virtual instruments (VIs) have three main parts the front panel, the block diagram, and the icon and connector pane The front panel is the user interface of a LabVIEW program and the block diagram is the executable code The block diagram contains the graphical source code composed of nodes, terminals, and wires Use Express VIs, standard VIs and functions on the block diagram to create your measurement code. For the most common requirements, use Express VIs with interactive configuration dialogs to define your application. Floating Palettes: Tools Palette, Controls Palette (only when Front Panel Window is active), and Functions Palette (only when Block Diagram Window is active) There are help utilities including the Context Help Window and LabVIEW Help 32
Summary Place controls (inputs) and indicators (outputs) in the front panel window Use the Operating tool to manipulate panel objects. Use the Positioning tool to select, move, and resize panel objects. Use the Wiring tool to connect diagram objects Control terminals have thicker borders than indicator terminals All front panel objects have property pages and shortcut menus Wiring is the mechanism to control dataflow and produce LabVIEW programs Broken Run arrow means a nonexecutable VI Various debugging tools and options available such as setting probes and breakpoints, execution highlighting, and single stepping 33
Tips Common keyboard shortcuts Windows Sun Linux MacOS <Ctrl-R> < -R> <M-R> < -R> Run a VI <Ctrl-F> < -F> <M-F> < -F> Find object <Ctrl-H> < -H> <M-H> < -H> Activate Context Help window <Ctrl-B> < -B> <M-B> < -B> Remove all broken wires <Ctrl-W> < -W> <M-W> < -W> Close the active window <Ctrl-E> < -E> <M-E> < -E> Toggle btwn Diagram/Panel Window Access Tools Palette with <shift>-right-click Increment/Decrement faster using <shift> key Tools»Options selection set preferences in LabVIEW VI Properties (File menu) 34