Presentation is loading. Please wait.

Presentation is loading. Please wait.

LabVIEW Course Course 1.

Similar presentations


Presentation on theme: "LabVIEW Course Course 1."— Presentation transcript:

1 LabVIEW Course Course 1

2 Graphical Programming for Test, Measurement, and Control
Rapid application development and easy-to-use graphical environment Interactive measurement assistants and powerful redesigned DAQ interface for connecting to all types of I/O Labview

3 Acquire, Analyze, and Present
Nearly all test, measurement, and control applications can be divided into 3 main components: the ability to acquire, analyze, and present data. LabVIEW = acquiring, analyzing, and presenting real-world data. Labview

4 Acquire with LabVIEW LabVIEW can acquire data using the following devices and more: GPIB, Serial, Ethernet, VXI, PXI Instruments Data Acquisition (DAQ) PCI eXtensions for Instrumentation (PXI) Image Acquisition (IMAQ) Motion Control Real-Time (RT) PXI PDA Modular Instruments Labview

5 Analyze with LabVIEW LabVIEW includes the following tools to help you analyze your data: More than 400 measurement analysis functions for Differential Equations, Optimization, Curve Fitting, Calculus, Linear Algebra, Statistics, etc. 12 new Express VIs specifically designed for measurement analysis, including filtering and spectral analysis Signal Processing VIs for Filtering, Windowing, Transforms, Peak Detection, Harmonic Analysis, Spectrum Analysis, etc. Powerful measurement analysis is built in to the LabVIEW development environment. Labview

6 Present with LabVIEW LabVIEW includes the following tools to help you present your data: On your machine — Graphs, Charts, Tables, Gauges, Meters, Tanks, 3D Controls, Picture Control, 3D Graphs (Windows Only), Report Generation (Windows Only) Over the Internet — Web Publishing Tools, Datasocket (Windows Only), TCP/IP, VI Server, Remote Panels, Enterprise Connectivity Toolset — SQL Tools (Databases), Internet Tools (FTP, Telnet, HTML) Presentation with LabVIEW can be done on your PC or over a network Labview

7 Course Goals Introduction to graphical programming environment
(Front Panel / Block Diagram / Connector/icons) Presentation of the key points for Labview programming (Vi / Sub Vi / Data types / Structures) Introduction to debugging techniques Labview

8 Course evaluation Fields Weight Files organization 20%
Quality of user interfaces 30% Quality of programs Behavior during the course Labview

9 Analyzing and saving data
Course Map Course 1 Course 2 Course 3 Making a decision First steps with LabVIEW Controlling property Loops Creation of new VI and customization Arrays Project Signal generation Modular programming Saving data Analyzing and saving data Data acquisition Express VI Labview

10 Lesson 1 Introduction to LabVIEW
TOPICS LabVIEW Environment Front Panel Block Diagram Dataflow Programming Customization of VI Labview

11 To start … … open LV_Getting_Started_Eng_2011.pdf and follow instructions until page 20 ! Labview

12 Summary New Dialog Box and Template VIs Front Panel Block Diagram
VI, Express Vis, functions, data formats Front Panel and Block Diagram Tools Running and Stopping a VI, Toolbars LabVIEW Documentation Resources Property Dialog Boxes Shortcuts Labview

13 How is composed a Virtual Instrument (VI)
Front Panel Controls = Inputs Indicators = Outputs Block Diagram Accompanying “program” for front panel Components wired together LabVIEW programs are called virtual instruments (VIs). Stress that controls equal inputs, indicators equal outputs. Each VI contains three main parts: Front Panel – How the user interacts with the VI. Block Diagram – The code that controls the program. Icon/Connector – Means of connecting a VI to other VIs. Labview

14 How is composed the Front Panel Window
Toolbar VI Icon Free Text Simple Numeric Indicator Numeric Control Waveform Graph Numeric Indicator Scale Legend This slide represents the front panel of a typical VI. Point out the elements in the Panel window: Panel Toolbar: contains tools and command buttons used to control the VI. Discuss the controls, indicators, and labels. Labview

15 How is composed the Block Diagram Window
Block Diagram Toolbar SubVI (VI Express) Graph Terminal Numeric Constant Wire Data Numerical Indicator Terminal This slide shows the block diagram for the front panel on the last slide. Point out front panel object terminals, constants, and nodes. (Note the Wait Until Next ms Multiple function, Divide function, subVI, and wires.) Reinforce front panel object-terminal relationship. While Loop Structure Timing Function Boolean Control Terminal Labview

16 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 Labview

17 Different data formats
Scalar 1D Array 2D Array Numeric Boolean String Not a complete list of data types; just ones that are used frequently through this course. Explain that in LabVIEW, you use wires to connect multiple terminals together to pass data in a VI. The wires must be connected to inputs and outputs that are compatible with the data that is transferred with the wire, therefore understanding the different data types is key to correct wiring. Explain the difference in colors and thicknesses. Explain that arrays and strings will be covered later in the course. Also, dynamic data type does not change width based on contents. Students are often looking for a more detailed list of all the data types in LabVIEW. If they ask about that, point them to the Help >> VI, Function, & How-To Help… On the Index Tab, search for data types and double click on the keyword to get a display on all of the data types and terminal representations in LabVIEW. Dynamic Labview

18 Tools Palette LabVIEW can automatically select 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 Graphical, floating palettes. Tools can be used for editing, debugging, and operating VIs. You can hide/show palettes by enabling or disabling them via the Window menu. Shortcut key (shift-right click - Windows) Although most will use the automatic tool selection, it is important that user understand the difference between the different tools so that they know when to use it. For example, when hovering over a boolean control, you may have the labeling tool, the selection tool or the operating tool depending on where the mouse cursor is. How do you know when to click? Demonstrate! Be sure to know all the correct names for the tools in the palette and take your time familiarizing students with their names. In particular, stress the difference between the Position/Resizing Tool and the Operator as students will often have the wrong tool and if you can vocally instruct them to get the correct tool it causes much less frustration. Labview

19 Front Panel − Controls Palette
Contains the most commonly used controls Graphical, floating palettes. You can access the Controls palette only from the Panel window. If palettes are not displayed, you can access them via the Window menu and select the Show Controls palette. OR, right click on open area of front panel or diagram window to display Controls palette. All Controls Palette Shows all controls Labview

20 Block Diagram − Functions Palette
Contains the Express VIs (interactive VIs with configurable dialog page) and the most commonly used functions Graphical, floating palettes. You can access the Functions palette only from the Block Diagram window. If palettes are not displayed, you can access them via the Window menu and select the Show Functions palette. OR, right click on open area of front panel or diagram window to display Functions palette. All Functions Palette Shows all functions Labview

21 Tools Palette Graphical, floating palettes
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 Graphical, floating palettes. If palettes are not displayed, you can access them via the Window menu and select the Show Functions/Controls palette. OR, right click on open area of panel or diagram window to display Controls and Functions palettes, respectively. Click on subpalettes to access functions, controls, VIs. You can tack down palettes and subpalettes using the pushpin. Tack down by clicking on the pushpin on the top left corner of the palette. Once tacked down you can set the palette options and use the find tool. Labview

22 File Edit Operate Tools Browse Window Help
Menu File Edit Operate Tools Browse Window Help The menus at the top of a VI window contain items common to other applications, such as Open, Save, Copy, and Paste, and other items specific to LabVIEW. Some menu items also list shortcut key combinations. Some menu items are unavailable while a VI is in run mode. The File menu contains items used for basic file operations, such as opening, closing, saving, and printing files. The Edit menu contains items that allow you to search for and modify LabVIEW files and their components. The Operate menu contains items you use to control the operation of your VIs. The Tools menu contains items for configuring LabVIEW, your projects, and your VIs. The Browse menu contains items that allow you to view aspects of the current VI and its hierarchy. The Window menu contains items that allow you to configure the appearance of the current windows and palettes. You also can access the Error List window and view the contents of the clipboard. The Help menu contains items to explaining and define LabVIEW features and other components, provide full LabVIEW documentation, and access National Instruments technical support. Labview

23 Front Panel and Block Diagram Toolbars
Run button Continuous Run button Abort button Pause/Continue button Font ring Alignment ring Distribution ring Resize ring Reorder ring Context Help Button Additional Buttons on the Block Diagram Toolbar Warning indicator Enter button Broken Run button Execution Highlighting button Step Into button Step Over button Step Out button Launch LabVIEW and discuss the buttons using the computer; never use the abort button or continuous run button when doing demonstrations. Set a good example! Tools used to create, modify, debug, and execute VIs: Panel Toolbar: Located in the Panel window. Broken Run: Click on it to find errors. Continuous Run: Use for testing sections of code. Should use a while/for loop for repeating parts of a diagram in an application. Stop: Not a clean way to terminate the program. Avoid using it. Use a switch on the panel. Diagram Toolbar: Additional tools to debug the VI. Briefly explain each button. Tell the class we will discuss them in more detail when we talk about debugging. When running a VI, the font, alignment, and distribution rings disappear because they are editing tools. Labview

24 Labview help Information about LabVIEW programming concepts, step-by-step instructions for using LabVIEW, and Reference information about LabVIEW VIs, functions, palettes, menus, tools, properties, methods, events, dialog boxes, and so on. Labview

25 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 Explain the options available for the numeric control, as shown on the slide. Also explain that property pages will differ dependant on the object selected. Labview

26 Some shortcuts Labview

27 Lesson 2 Creation of a new VI and customization
TOPICS New VI creation Dataflow Programming Customization of VI Labview

28 Exercise 2.1 - Convert °K to °F
Goal Create a simple VI Topic : convert a Kelvin temperature into Fahrenheit Concepts Simple mathematic function, numeric format Commands and indicators Dataflow, help, debugging Displays customized Homework Open a new VI Build a VI that converts °K to °F Save in « 1_KtoF.vi » Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

29 Step 1 : 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… Click the New button to create a new VI. Click the arrow on the New button to choose to open a blank VI or to open the New dialog box. Labview

30 Composition of a new VI Diagram (D) Front Panel (FP) Labview

31 Creating a VI Front Panel
Build the front panel with controls (inputs) and indicators (outputs) Numeric Indicator Owned Labels Increment Buttons Creating the front panel (user interface): Built with controls and indicators: Controls: Supply data to the VI. Indicators: Display data generated by the VI. They can find out if it is a control or indicator by checking the right-click menu of the object and referring to the third item (Change to Indicator or Change to Control) Explain graphics on slide: Numeric controls: Point out increment buttons. Numeric indicators: No increment buttons. Boolean objects: Ask class which Boolean is a control and which is an indicator. Explain that even though an LED is an indicator in the real world, it can be changed to a control in LabVIEW. Demonstrate. Numeric Control Boolean Control Boolean Indicator Labview

32 Step 2 : Create the Front Panel
Create this Front Panel using the Controls Palette Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

33 Shortcut Menus for Front Panel Objects
Right-click the digital display to access its shortcut menu Right-click the label to access its shortcut menu Right-click menus: Most often used LabVIEW menus. Most LabVIEW objects have these menus for modification of attributes pertaining to that object. Functions/Controls palettes are available as right-click menus. Labview

34 Step 3 : Creating a VI Block Diagram
Front Panel Indicator Control Block Diagram Control Terminal The block diagram is the “code” for the VI. Note: Wires can cross each other. You will see dots at the wire junctions, and a small gap in the wire showing that wires do not connect. If dots at wire junctions have been turned off, go to Options (Tools menu)»Block Diagram and select Show dots at wire junctions. Point out border difference and arrow direction on controls and indicator terminals. Composed of nodes, terminals, and wires: Nodes: Program execution elements (analogous to statements, functions, and subroutines). Functions: Built-in nodes for elementary functions. SubVIs: VIs you design and later call from the diagram of another VI. Structures: Control the program flow. Indicator Terminal Constant Wires Nodes Labview

35 Wiring Techniques Automatic Wiring Use Context Help Window when wiring
Hot Spot 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 Demonstrate wiring by placing two controls, one indicator, and an Add function. Use the Help window (point out how terminals in the Help window flash when the tool passes over the actual function terminal). right-click on the Add function and select Show Terminals. Point out Tip Strips. If students really struggle with wiring, remember that they can enable the Terminal view and that can help. If that is still not enough, they can enable the option to have nodes placed as expandable. That won’t fix all problems, and the last option is to reduce the monitor resolution to something like 800x600. View the terminal connections to a function Labview

36 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 text-based programming languages Right-click and toggle View As Icon to change the icon view Labview

37 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 If required is unwired, receive error when running program. If recommended is unwired, receive warning when running program. If optional is unwired, no effect when running program. Give examples! The more examples of how you have used things to solve customer problems, the more they will trust you. Something that every LabVIEW supporter uses is Context Help. Explain how we cannot all be responsible for knowing what every function or VI does and we do not expect that of them, either, but that Context Help is our encyclopedia for VIs and functions. This is also a good place to begin getting them to think about good documentation practices of their own VIs so that users of their programs can get the same help. Simple/Detailed Context Help Lock Help More Help Labview

38 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. Use an example program to demonstrate the help tools. Suggestion: Open help and search the index using ‘menus’. You can then show the class where they can find information on the menu items discusses in the earlier slide. Labview

39 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 Most text based programs execute in an control flow model. Dataflow is the principle that governs how LabVIEW programs execute. Explain the diagram on this slide with emphasis on dataflow. The node executes when data is available at all of its input terminals. The node supplies data on output terminals when it finishes execution. Not executed left to right nor top to bottom. Test understanding by asking class what will happen first when this program runs. Then, build the above diagram on your computer and demonstrate the dataflow using execution highlighting. It is helpful to start out by asking the class what they think will happen first on this block diagram. You will get answers from Number 1-4, random number, etc., but eventually someone will say that there is no way to know. Then, show will execution highlighting. Labview

40 Step IV : Save the VI Save the VI as “1_KtoF.vi” Then execute it !
(in a specific folder) Then execute it ! Labview

41 Customization of displays
Goals Insert comments for users Adapt displays to the application What sort of customization ? Free text Models of commands and indicators Scale Labview

42 1) Free text Useful to inform user Authorized on FP et D In example,
Add something like : ‘ Temperature conversion ’. Then, change font, size, color … (via FP Toolbar) Labview

43 2) Customization of displays
Shortcut menu of object 2. Choose the right indicator Labview

44 Exercise 2.2 - Customization of displays
Goal Modify a VI Topic : Customization with specific models of indicator and messages Concepts Free text Customization of displays Homework Open « 1_KtoF.vi » Replace numerical indicator with temperature indicator Insert free text in FP and D to legend them Save in « 2_KtoF.vi » Labview

45 Exercise 2.2 : FP customized
Labview

46 Exercise 2.2 : D customized
Labview

47 Lesson 3 Modular Programming
TOPICS SubVIs Icon and Connector Pane Using SubVIs Creating a SubVI from sections of a VI Labview

48 LabVIEW Hierarchy SubVI LabVIEW is hierarchical in nature:
You can have many layers of VIs. Very modular, easy to debug and change. This is why LabVIEW is so powerful. Explain the example in the slide: Show the relationship between front panel objects and their corresponding terminals on the block diagram. Power: control for stopping the measurements. Temperature History: indicator that displays the temperatures that have been read. Labview

49 SubVIs Function Pseudo Code SubVI Block Diagram
function average (in1, in2, out) { out = (in1 + in2)/2.0; } SubVI Block Diagram Calling Program Pseudo Code main { average (point1, point2, pointavg) } Calling VI Block Diagram A subVI is analogous to a subroutine. When creating a VI, you should: Start with the top-level VI and define input and output. Construct subVIs as necessary to implement the desired functionality in the block diagram. The modular approach makes applications easier to debug and maintain. Explain diagram. (The functionality of the subVI does not matter for this example. The important point is the passing of two numeric inputs and one numeric output.) Labview

50 Icon/Connector An icon represents a VI in other block diagrams
terminals Icon An icon represents a VI in other block diagrams A connector passes data to and receives data from a subVI through terminals Connector Icon: Means of turning a VI into an object that can be used in other programs (compare it to a subroutine). Graphically represents the VI in the block diagram of other VIs. Connector: Terminals define where to wire inputs and outputs. Analogous to parameters of a subroutine. Terminals correspond to controls and indicators on the front panel. Hidden under the icon unless the user chooses to view it. terminals Labview

51 SubVI Example – Conversion temperature
A VI within another VI is called a subVI To use a VI as a subVI, create an icon and a connector pane after building the front panel and block diagram Instructor: Build this example subVI slope.vi on your computer and demonstrate creating an icon/connector and calling the VI from another VI along with the next four slides. Labview

52 Steps for creating a SubVI
Create the Icon Create the Connector Assign Terminals Save the VI Insert the VI into a Top Level VI Labview

53 Creating the Icon Icon: graphical representation of a VI
Right-click in the icon pane (Panel or Diagram) Always create a black and white icon Default Icon Create a custom icon Every VI has its icon displayed in the upper right corner of the Panel and Diagram windows. (The default is a LabVIEW icon.) Use Icon Editor to design the icon. From the Panel or Diagram window, right-click on the icon and select Edit Icon... Design separate icons for monochrome, 16-bit color, and 256-bit color modes. You must design a monochrome icon if you want the icon to display on the Functions palette. Use the Copy From command to make a copy from one color mode to another. Double-click on Select tool and press delete to clear icon Double-click on Rectangle tool to add border around icon Keep it simple, its not an art lesson Using your computer, demonstrate each tool in the Icon Editor and draw a simple icon. You can also copy and paste into the icon editor. Labview

54 Creating the Connector
Right-click the icon (Front Panel only) The connector is a programmatic interface to a VI: Data passes from controls and to indicators via terminals on the connector. The connector is defined by assigning Front Panel objects to input and output terminals. Demonstrate the Show Connector option: A Connector Pane replaces the icon. Pattern selection is based on objects on the front panel. To select a different pattern, right-click on the connector and choose Patterns. Note the various ways to rotate and flip patterns. Labview

55 Creating the Connector - continued
Click with wiring tool Demonstrate how you can illustrate which terminal is attached to which control/indicator. Click on a terminal or control. Labview

56 Assign terminals via the Connector Pane
Terminal colors match the data types to which they are connected Click the terminal to see its associated front panel object Connector continued. … and save the VI ! Labview

57 Using a VI as a SubVI All Functions » Select a VI…
<OR> Drag icon onto target diagram Drag file onto target diagram You can use any VI that has an icon and connector as a subVI in the block diagram of another VI. Drag the icon pane to the diagram of the target VI. Select the Select a VI... option from the Functions palette. The file dialog box is displayed. Select any VI file. Add commonly used VIs to the Functions palette by placing them in User.lib in the LabVIEW directory. SubVIs are analogous to a subroutine: A node is not a subVI itself, just a subroutine call. Identical nodes in the diagram call the same subVI. To open, double-click the left mouse button on the icon. Changes to a subVI: Saved in memory until the subVI is saved to disk. Affect all calls to it, not just the node used to open it. Labview

58 Help and Classifying Terminals
Classify inputs and outputs: Required — Error if no connection Recommended — Warning if no connection Optional — No effect if no connection Classify controls or outputs as required, recommended, or optional to remind users to wire inputs or outputs. Classify by being in the connector pane and selecting This connector is >>. Help windows show classifications as shown above (for example, bold for a required terminal). Demonstrate using a DAQ VI Required classification - If input is not wired, VI will be broken. Will be displayed in bold text in Help Menu Recommended classification - Displayed as plain text in Help menu Optional classification - dims description or hides the description in the Simple View of the Help window. Labview

59 Exercise 3.1 – Generate temperature using SubVI
Goal Create a simple VI Topic : convert a Kelvin temperature into Fahrenheit Concepts SubVI Homework Create icon and connector of « 1_KtoF.vi », save it and close Create a new VI in order to generate a randomly temperature between T0–DT et T0+DT : 2 inputs T0(°K) and DTmax(°K) 2 outputs T(°K) and T(°F) You have to use the VI  « 1_KtoF.vi » Save in « 3_Gen_temp_conv.vi » Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

60 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 Use the buttons on top of the palette windows to navigate, search, and edit the palettes. You can search for controls, VIs, and functions that either contain certain words or start with certain words. Double clicking a search result opens the palette that contains the search result. You also can click and drag the name of the control, VI, or function directly to the front panel or block diagram. For the exercise, search for “Random number” Labview

61 Exercise 3.1 : D Labview

62 Exercise 3.2 : FP Labview

63 Complement : another way for creating a subVI
It exists an other way to simply create SubVi. Indeed, just by selecting the part of the program in which you're interested in creating a SubVi you can achieve it. But this method performs some automatic assignments and you will have to be careful when you use it… Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

64 Selection of the program part
Labview

65 Creation of the Sub Vi Labview

66 Terminal assignment & icon
Once the creation is achieved, the selected program part becomes an icon. You can edit it to customize its appearance. Moreover, if you look at the terminal assignment, it has automatically be generated. However, you can change it with the method studied in lesson 2. Labview

67 Exercise 3.2 Goal Homework SubVI creation Open "3_Gen_temp_conv.vi".
Replace the generation part by a subVI. Customize the SubVI icon. Suppress the automatic assignment of "T0" and "dTmax" Save the SubVI as "3Compl1_Gen_temp_conv.vi" Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

68 Summary VIs can be used as subVIs after you make the icon and connector Icon created using Icon Editor Connector defined by choosing number of terminals Load subVIs using the Select a VI option in the All Functions palette or dragging the icon onto a new diagram Online help for subVIs using the Show Context Help option Descriptions document functionality Use Create SubVI feature to easily modularize the block diagram Do not immediately display this slide. Suggested questions for class participation: A VI used as a subVI must have what two parts? How do you create an icon? How do you define a connector? How do you load a subVI into a LabVIEW diagram? How can you modularize the program in your diagram? Review the slide: The purpose of Lesson Two was to introduce the hierarchical nature of LabVIEW and the concept of subVIs. The ability to call VIs as subVIs facilitates modular block diagrams. Applications are more flexible and easier to understand, debug, and modify. Online help provides information about each node. Modularize whenever possible. Labview

69 Lesson 4 Simple acquisition
TOPICS Replacing simulation by acquisition Data acquisition, acquisition of 1 point Labview

70 Data Acquisition Hardware (1/2)
DAQ Device Data acquisition (DAQ) basics Connecting Signals Simple DAQ application Cable Computer Sensors Terminal Block Labview

71 Data Acquisition Hardware (2/2)
Channel names Sine Wave 1 ai 0 Signals ai 1 Sine Wave 2 ai 2 Sine Wave 3 Tasks Timing and Triggering Labview

72 Data Acquisition in LabVIEW
Traditional NI-DAQ Specific VIs for performing: Analog Input Analog Output Digital I/O Counter operations NI-DAQmx Next generation driver: VIs for performing a task One set of VIs for all measurement types The Data Acquisition palette in LabVIEW contains a palette for traditional NI-DAQ and one for NI-DAQmx. Traditional VIs are divided by the type of measurement; DAQmx VIs are divided by the type of task. You must complete several steps before you can use the Data Acquisition VIs. The devices should be configured for the computers in this class. NI-DAQ software must be installed on the computer You must have installed an E-series DAQ board and configured it using Measurement & Automation Explorer (MAX). For more information on installing and configuring National Instruments hardware, consult the DAQ Quick Start Guide: Labview

73 Steps for creating and acquisition task
How to create a task to acquire an analogous tension ? In Diagram, open Palette de fonction Express > Entrées > Assistant DAQ Acquérir un signal > Entrée analogique > Tension Parameters : Configuration du terminal : RSE (ground ref.) Paramètres de cadencement / Mode d’acquisition : 1 échantillon sur demande Labview

74 Exercise 4.1 – Simple Data Acquisition
Goal Acquire analog signal Topic : acquire voltage from thermistor Concepts Assistant acquisition data and hardware Formula node Homework Step 1 : In a blank vi, create an acquisition task, 1point, tension, -10/+10, RSE Step 2 : Convert the measured voltage into temperature with formula node or express. Save it as “Acq_Temp.vi” Step 3 : Open the vi “Sim_temp_conv2.vi” and replace the simulation part (“specifications and generation”) by the acquisition part and save it in “Acq_Temp_conv.vi” Note: To complete this exercise, you will need the IC temperature sensor available on either the BNC-2120, SCB-68 or DAQ Signal Accessory. Estimated completion time: 30 minutes. Instructions: This exercise has three parts. First, create an icon and connector for Convert C to F.vi (Exercise 1). The icon should remind you of the functionality of the VI (e.g. CF or CtoF). The connector should have one input and one output, allowing a terminal for °C in, and °F out. Second, create a top level VI that acquires a data point from channel 0 (the temperature sensor) of your DAQ board and allows the user to display the temperature in Celsius or Fahrenheit. To do this you will need to acquire a single data point from your DAQ board and scale it by a factor of 100. This will give you °C. You should have a Boolean switch or button that allows the user to select Celsius or Fahrenheit. If the user selects Celsius, the scaled value should be displayed in a thermometer indicator. If the user selects Fahrenheit, the Celsius value should be passed into Convert C to F.vi (used as a subVI), and the output Fahrenheit value should be displayed. Hint: Use the Select function in the Comparison palette. Labview

75 Rth = f(Uth) ? Electronic system Vcc = +10V R0 = 10 500 Ohms
Labview

76 Ref thermistor : Labview

77 Exercise 4.1 – D Labview

78 Exercise 4.1 – FP Labview

79 Exercise 4.1 – D With express VIs With subVI Labview

80 Exercise 4.1 : Front Panel (FP)
Labview

81 Complement : another way for implementing mathematical function
For sure, basic mathematical functions for huge calculus won't be very practical nor very efficient. They lead to complicated programs, and Labview propose the use of higher level functions like "expression node" or "formula node"… Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview

82 Exercise 4.2 Goal Homework
Use of higher level function for mathematical calculus Creation of SubVI Homework Open "4_Acq_Temp_conv.vi" Replace the Calculus part by a "formula node" or an "expression node" Create a SubVI performing the acquisition and the conversion. This SubVI won't have any input terminal and just one output terminal. Save as "4Compl2_Acq_Temp_conv.vi" Estimate completion time: 20 minutes. The exercise is easy, but since it will be the first VI that we actually create, it is good to allow ample time to explore the LabVIEW environment. Instructions: Build a VI that converts °C to °F. When run, the VI should take an input value (°C), multiply it by 1.8, add 32, and display the result (°F). The front panel should display both the input value and the result. Save the VI as Convert C to F.vi. Labview


Download ppt "LabVIEW Course Course 1."

Similar presentations


Ads by Google