Introduction to LabVIEW TM Three Hour Course Course Software Version X X September 2003 Edition Part Number 323668B 01 Copyright 2003 National Instruments Corporation All rights reserved Universities colleges and other educational institutions may reproduce all or part of this publication for educational use For all other uses this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation Trademarks LabVIEW National Instruments NI and ni com are trademarks of National Instruments Corporation Product and company names mentioned herein are trademarks or trade names of their respective companies Patents For patents covering National Instruments products refer to the appropriate location Help Patents in your software the patents txt file on your CD or ni com legal patents Worldwide Technical Support and Product Information ni com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 Worldwide Offices Australia 1800 300 800 Austria 43 0 662 45 79 90 0 Belgium 32 0 2 757 00 20 Brazil 55 11 3262 3599 Canada Calgary 403 274 9391 Canada Montreal 514 288 5722 Canada Ottawa 613 233 5949 Canada Qu bec 514 694 8521 Canada Toronto 905 785 0085 Canada Vancouver 514 685 7530 China 86 21 6555 7838 Czech Republic 420 2 2423 5774 Denmark 45 45 76 26 00 Finland 385 0 9 725 725 11 France 33 0 1 48 14 24 24 Germany 49 0 89 741 31 30 Greece 30 2 10 42 96 427 India 91 80 51190000 Israel 972 0 3 6393737 Italy 39 02 413091 Japan 81 3 5472 2970 Korea 82 02 3451 3400 Malaysia 603 9131 0918 Mexico 001 800 010 0793 Netherlands 31 0 348 433 466 New Zealand 0800 553 322 Norway 47 0 66 90 76 60 Poland 48 0 22 3390 150 Portugal 351 210 311 210 Russia 7 095 783 68 51 Singapore 65 6226 5886 Slovenia 386 3 425 4200 South Africa 27 0 11 805 8197 Spain 34 91 640 0085 Sweden 46 0 8 587 895 00 Switzerland 41 56 200 51 51 Taiwan 886 2 2528 7227 Thailand 662 992 7519 United Kingdom 44 0 1635 523545 Virtual Instrumentation With LabVIEW 1 Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Build a simple data acquisition application Create a subroutine in LabVIEW This is a list of the objectives of the course This course prepares you to do the following Use LabVIEW to create applications Understand front panels block diagrams and icons and connector panes Use built in LabVIEW functions Create and save programs in LabVIEW so you can use them as subroutines This course does not describe any of the following Programming theory Every built in LabVIEW function or object Analog to digital A D theory 2 Section I LabVIEW terms Components of a LabVIEW application LabVIEW programming tools Creating an application in LabVIEW 3 LabVIEW Programs Are Called Virtual Instruments VIs 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 The Front Panel is used to interact with the user when the program is running Users can control the program change inputs and see data updated in real time Stress that controls are used for inputs adjusting a slide control to set an alarm value turning a switch on or off or stopping a program Indicators are used as outputs Thermometers lights and other indicators indicate values from the program These may include data program states and other information Every front panel control or indicator has a corresponding terminal on the block diagram When a VI is run values from controls flow through the block diagram where they are used in the functions on the diagram and the results are passed into other functions or indicators 4 VI Front Panel Front Panel Toolbar Icon Boolean Control Graph Legend Waveform Graph Scale Legend Plot Legend The front panel is the user interface of the VI You build the front panel with controls and indicators which are the interactive input and output terminals of the VI respectively Controls are knobs pushbuttons dials and other input devices Indicators are graphs LEDs and other displays Controls simulate instrument input devices and supply data to the block diagram of the VI Indicators simulate instrument output devices and display data the block diagram acquires or generates In this picture the Power switch is a boolean control A boolean contains either a true or false value The value is false until the switch is pressed When the switch is pressed the value becomes true The temperature history indicator is a waveform graph It displays multiple numbers In this case the graph will plot Deg F versus Time sec The front panel also contains a toolbar whose functions we will discuss later 5 VI Block Diagram Block Diagram Toolbar Divide Function SubVI Graph Terminal Wire Data While Loop Structure Timing Function Numeric Constant Boolean Control Terminal The block diagram contains this graphical source code Front panel objects appear as terminals on the block diagram Additionally the block diagram contains functions and structures from built in LabVIEW VI libraries Wires connect each of the nodes on the block diagram including control and indicator terminals functions and structures In this block diagram the subVI Temp calls the subroutine which retrieves a temperature from a Data Acquisition DAQ board This temperature is plotted along with the running average temperature on the waveform graph Temperature History The Power switch is a boolean control on the Front Panel which will stop execution of the While Loop The While Loop also contains a Timing Function to control how frequently the loop iterates 6 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 Function Standard VI Express VI LabVIEW 7 0 introduced a new type of subVI called Express VIs These are interactive VIs that have a configuration dialog box that allows the user to customize
View Full Document