3Navigating LabVIEW Virtual Instruments (VIs) Parts of a VI Starting a VIProject ExplorerFront PanelBlock DiagramSearching for Controls, VIs and FunctionsSelecting a ToolDataflowPolymorphism~2.5 hours spent on this lesson, including exercises. This lesson is an introduction to navigating LV; you will later cover implementation.
4A. Virtual Instruments (VIs) Virtual Instrument (VI) – A LabVIEW programThe appearance and operation of VIs imitate physical instruments, such as oscilloscopes and digital multimeters.
5B. Parts of a VILabVIEW VIs contain three main components: 1. Front Panel 2. Block Diagram 3. Icon/Connector Pane
6B. Parts of a VI – Front Panel Front Panel – User interface for the VIYou build the front panel with controls (inputs) and indicators (outputs)
7B. Parts of a VI – Block Diagram Block Diagram – Contains the graphical source codeFront panel objects appear as terminals on the block diagram
8B. Parts of a VI – Icon/Connector Pane Icon: graphical representation of a VIConnector Pane: map of the inputs and outputs of a VIIcons and connector panes are necessary to use a VI as a subVIA subVI is a VI that is inside of another VISimilar to a function in a text-based programming languageIcon Connector Pane
9C. Starting a VIDemonstrate using the Getting Started dialog box and the New dialog box to start a VI.
10D. Project Explorer Use LabVIEW Projects to: Group LabVIEW files and non-LabVIEW filesCreate build specificationsDeploy or download files to targetsLabVIEW project files (.lvproj) include:- references to files in the project- configuration information- build information- deployment information- etcUse the Project Explorer window to create and edit LabVIEW projectsSelect File»New Projectto display the ProjectExplorer windowYou also can select Project»New Project orselect Empty Project in the New dialog box to display the Project Explorer window
11Using the Project Explorer Demonstrate creating a project, adding files, and removing files.
12E. Front Panel – Controls Palette Contains the controls and indicators you use to create the front panelAccess from the front panel by selecting View»Controls Palette
14E. Front Panel – Controls & Indicators Knobs, push buttons, dials, and other input devicesSimulate instrument input devices and supply data to the block diagram of the VIIndicatorsGraphs, LEDs, and other displaysSimulate instrument output devices and display data the block diagram acquires or generates
15E. Front Panel – Numeric Controls/Indicators The numeric data type can represent numbers of various types, such as integer or realNumeric ControlIncrement/Decrement ButtonsNumeric Indicator
16E. Front Panel – Boolean Controls/Indicators The Boolean data type represents data that only has two parts, such as True and False or On and OffUse Boolean controls and indicators to enter and display Boolean (True or False) valuesBoolean objects simulate switches, push buttons, and LEDsBooleanControlBooleanIndicator
17E. Front Panel – StringsThe string data type is a sequence of ASCII charactersUse string controls to receive text from the user such as a password or user nameUse string indicators to display text to the user
18LabVIEW Data Types – Terminals Terminals visually communicate information about the data type represented
19LabVIEW Data Types – Numerics The numeric data type represents numbers of various typesTo change the representation of a numeric, right-click the control, indicator, or constant, and select Representation from the shortcut menu
20LabVIEW Data Types – Boolean Behavior of Boolean controls is specified by the mechanical actionIn LabVIEW, the Boolean data type is represented with the color green
21Mechanical Action of Booleans Use the Mechanical Action of Booleans VI located in the NI Example Finder to learn about the different switch and latch actions.
22Data Types – StringA sequence of displayable or non-displayable ASCII charactersOn the front panel, strings appear as tables, text entry boxes, and labelsChange the display type from the short-cut menu: Normal, ‘\’ Codes, Password and HexEdit and manipulate strings with the String functions on the block diagramIn LabVIEW, the string data type is represented with the color pink
23Data Types – EnumAn enum represents a pair of values, a string and a numeric, where the enum can be one of a defined list of values
24Data Types – Enum Enum: enumerated control, constant, or indicator Enums are useful because it is easier to manipulate numbers than strings on the block diagram
25Data Types – DynamicStores the information generated or acquired by an Express VINon-Express VIs do not accept the dynamic data typeTo use a built-in VI or function to analyze or process the dynamic data type, you must convert the data typeNumeric, waveform, or Boolean data indicators or inputs automatically convert the dynamic data type when wiredIn LabVIEW, the dynamic data type is represented with the color dark blue
26E. Front Panel – Shortcut Menus All LabVIEW objects have associated shortcut menusAs you create a VI, use the shortcut menu items to change the look or behavior of front panel and block diagram objectsTo access the shortcut menu, right-click the object
27E. Front Panel – Property Dialog Box Right-click a front panel object and select Properties to displayThe options available on the property dialog box are similar to the options available on the shortcut menu for that object
28E. Front Panel – Configure Multiple Objects Select multiple objects to simultaneously configure shared properties
29F. Block Diagram Terminals SubVIs Functions Constants Structures Wires Block diagram objects include the following:TerminalsSubVIsFunctionsConstantsStructuresWires
30F. Block Diagram – Functions Palette Contains the VIs, functions, and constants you use to create the block diagram
32F. Block Diagram – Terminals Terminals are:Block diagram appearance of front panel objectsEntry and exit ports that exchange information between the front panel and block diagramAnalogous to parameters and constants in text-based programming languagesChange the view type of a terminal by toggling the View as Icon selection from the context menu
34F. Block Diagram – NodesObjects on the block diagram that have inputs and/or outputs and perform operations when a VI runsAnalogous to statements, operators, functions, and subroutines in text-based programming languagesNodes can be functions, subVIs, or structuresNodes
35F. Block Diagram – Function Nodes Fundamental operating elements of LabVIEWDo not have front panels or block diagrams, but do have connector panesDouble-clicking a function only selects the function – does not open it like a VIHas a pale yellow background on its icon
36F. Block Diagram – SubVI Nodes SubVI: VIs that you build to use inside of another VIAny VI has the potential to be used as a subVIWhen you double-click a subVI on the block diagram, you can view the front panel and block diagram of the subVIThe upper right corner of the front panel and block diagram displays the icon for the current VIThis is the icon that appears when you place the VI on a block diagram as a subVI
37F. Block Diagram – SubVI Nodes Express VIs are a special type of subVIRequire minimal wiring because you configure them with dialog boxesSave the configuration of an Express VI as a subVIIcons for Express VIs appear on the block diagram as icons surrounded by a blue field
39F. Block Diagram – WiresTransfer data between block diagram objects through wiresWires are different colors, styles, and thicknesses, depending on their data typesA broken wire appears as a dashed black line with a red X in the middleDBL Numeric Integer Numeric StringScalar1D Array2D Array
40F. Block Diagram – Wiring Tips Press <Ctrl>-B to delete all broken wiresRight-click and select Clean Up Wire to reroute the wire
41F. Block Diagram – Wiring Tips Use the Clean Up Diagram tool to reroute multiple wires and objects to improve readabilitySelect a section of your block diagramClick the Clean Up Diagram button on the block diagram toolbar
42Exercise 2-1 Concept: Exploring a VI Identify the parts of an existing VI.
43Exercise 2-1 Concept: Exploring a VI What are constants and when should you use them?What are free labels and when should you use them?What are constants and when should you use them?Constants are terminals on the block diagram that supply fixed data values to the block diagram. Use constants when your VI needs to use the same value every time the VI runs.What are the free labels and when should you use them?Free labels are not attached to any object, and you can create, move, rotate, or delete them independently. Use them to add comments to 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.Note: Constants and free labels have not been discussed yet, so now is a good time to briefly describe them and their purposes.
44G. Searching for Controls, VIs & Functions Find controls, functions, and VIs using the Search button on the Controls and Functions palette.
45G. Global SearchThe Search bar in the top right of the Front Panel and Block Diagram windows can be used to search the palettes, help, and ni.com.New feature in LabVIEW Searches the local Help files and palettes as you type and if you press enter it will also search community and ni.com.
46Exercise 2-2 Concept: Navigating Palettes Learn to use the palettes and search for controls, functions and VIs.
47Exercise 2-2 Concept: Navigating Palettes Why would you want to add a function to the Favorites category in the Functions palette?Why would you want to add a function to the Favorites category in the Functions palette?You can put commonly-used functions in an easy-to-access category.
48H. Selecting A ToolCreate, modify, and debug VIs using the tools provided by LabVIEWA tool is a special operating mode of the mouse cursorThe operating mode of the cursor corresponds to the icon of the tool selectedWhen using the Automatic Tool Selection, LabVIEW chooses which tool to select based on the current location of the mouse
49Exercise 2-3 Concept: Selecting A Tool Gain experience using the Automatic Tool Selection to select which tool to use.
50Exercise 2-3 Concept: Selecting A Tool How do you enable automatic tool selection?How do you enable automatic tool selection?Make sure that the Automatic Tool Selection button is enabled on the Tools Palette. To view the Tools Palette, you can either select View»Tools Palette or hold Shift while right-clicking.
51I. Dataflow LabVIEW follows a dataflow model for running VIs A node executes only when data are available at all of its input terminalsA node supplies data to the output terminals only when the node finishes executionLabVIEW is NOT control flow. Visual Basic, C++, JAVA, and most other text-based programming languages follow a control flow model of program execution.Sequential order of program elements determines execution order.LabVIEW follows a dataflow model for running VIs.A block diagram node executes when it receives all required inputs.When a node executes, it produces output data and passes the data to the next node in the dataflow path.The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.
52I. Dataflow – Quiz Which node executes first? Add Subtract Random NumberDivideSineThere is no right answer to this quiz, but there are some wrong answers. This quiz is intended to encourage students to think about dataflow and its implications...
53I. Dataflow – Quiz Answers NO CORRECT ANSWERWhich node executes first?Add – possiblySubtract – definitely notRandom Number – possiblyDivide – possiblySine – definitely not
54Exercise 2-4 Concept: Dataflow Understand how dataflow determines the execution order in a VI.
55Exercise 2-4 Concept: Dataflow Should a well-designed block diagram flow in a particular direction?Should a well-designed block diagram flow in a particular direction?Yes, a well-designed block diagram typically flows from left to right. This makes it easier to see the flow of data on the block diagram.
56J. PolymorphismDefinition: a programming language feature that allows values of different data types to be handled using a uniform interface.In LabVIEW: the ability of VIs and functions to automatically adapt to accept input data of different data typesi.e. Numeric FunctionsUseful when performing the same operation on different data typesIn short, polymorphism is the ability of a node to accept/handle various data types.
57Summary—Quiz Which function executes first: Add or Subtract? Add UnknownThe answer is a.
58Summary—Quiz Answer Which function executes first: Add or Subtract? UnknownThe answer is a.
59Summary—Quiz Which function executes first: Sine or Divide? Sine UnknownThe answer is b.
60Summary—Quiz Answer Which function executes first: Sine or Divide? UnknownThe answer is b.
61Summary—QuizWhich of the following functions executes first: Random Number, Add or Divide?Random NumberDivideAddUnknownThe answer is d.
62Summary—Quiz AnswerWhich of the following functions executes first: Random Number, Add or Divide?Random NumberDivideAddUnknownThe answer is d.
63Summary—QuizWhich of the following functions execute last: Random Number, Subtract or Add?Random NumberSubtractAddUnknownThe answer is b.
64Summary—Quiz AnswerWhich of the following functions execute last: Random Number, Subtract or Add?Random NumberSubtractAddUnknownThe answer is b.
65Summary—Quiz What are the three parts of a VI? Front Panel Block DiagramProjectIcon/Connector PaneThe answer is a, b, and d.
66Summary—Quiz Answer What are the three parts of a VI? Front Panel Block DiagramProjectIcon/Connector PaneThe answer is a, b, and d.