首页 Introduction to LabVIEW 8 in 6 Hours

Introduction to LabVIEW 8 in 6 Hours

举报
开通vip

Introduction to LabVIEW 8 in 6 Hoursnull6-Hour Hands-On6-Hour Hands-OnIntroduction to LabVIEWCourse GoalsCourse GoalsBecome comfortable with the LabVIEW environment and data flow execution Ability to use LabVIEW to solve problems LabVIEW Concepts Acquiring, saving and loading data Find and use m...

Introduction to LabVIEW 8 in 6 Hours
null6-Hour Hands-On6-Hour Hands-OnIntroduction to LabVIEWCourse GoalsCourse GoalsBecome comfortable with the LabVIEW environment and data flow execution Ability to use LabVIEW to solve problems LabVIEW Concepts Acquiring, saving and loading data Find and use math and complex analysis functions Work with data types, such as arrays and clusters Displaying and printing results The Virtual Instrumentation Approach The Virtual Instrumentation Approach LabVIEW Graphical Development SystemLabVIEW Graphical Development SystemGraphical Programming Environment Compile code for multiple OS and devices Useful in a broad range of applications Virtual Instrumentation ApplicationsVirtual Instrumentation ApplicationsDesign Signal and Image Processing Embedded System Programming (PC, DSP, FPGA, Microcontroller) Simulation and Prototyping And more… Control Automatic Controls and Dynamic Systems Mechatronics and Robotics And more… Measurements Circuits and Electronics Measurements and Instrumentation And more…A single graphical development platformThe NI Approach – Integrated Hardware PlatformsThe NI Approach – Integrated Hardware PlatformsSection I – LabVIEW EnvironmentSection I – LabVIEW EnvironmentA. Getting Data into your Computer Data Acquisition Devices NI-DAQ Simulated Data Acquisition Sound Card B. LabVIEW Environment Front Panel / Block Diagram Toolbar /Tools Palette C. Components of a LabVIEW Application Creating a VI Data Flow Execution D. Additional Help Finding Functions Tips for Working in LabVIEWA. Setting Up Your HardwareA. Setting Up Your HardwareData Acquisition Device (DAQ) Actual USB, PCI, or PXI Device Configured in MAX Simulated Data Acquisition Device (DAQ) Software simulated at the driver level Configured in MAX Sound Card Built into most computers Track ATrack BTrack CDo Not DeleteDo Not DeleteNotes on hardware setupWhat type of device should I use? What type of device should I use? * The above table may not be representative of all device variations that exist in each categoryWhat is MAX?What is MAX?MAX stands for Measurement & Automation Explorer. MAX configures and organizes all your National Instruments DAQ, PCI/PXI instruments, GPIB, IMAQ, IVI, Motion, VISA, and VXI devices. Used for configuring and testing devices.Icon Found on Windows DesktopExercise 1 – Setting Up Your DeviceExercise 1 – Setting Up Your DeviceUse Measurement and Automation Explorer (MAX) to: Configure and test your Data Acquisition (DAQ) deviceTrack ADo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsExercise 1 – Setting Up Your DeviceExercise 1 – Setting Up Your DeviceUse Measurement and Automation Explorer (MAX) to: Configure and test your Simulated Data Acquisition (DAQ) deviceTrack BDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsExercise 1 – Setting Up Your DeviceExercise 1 – Setting Up Your DeviceUse Windows to: Verify your Sound CardTrack CUn-Mute MicrophoneOpen and Run LabVIEWStart»All Programs»National Instruments LabVIEW Startup Screen:Start from a Blank VI: New»Blank VI Start from an Example: Examples»Find Examples… »orOpen and Run LabVIEWLabVIEW Programs Are Called Virtual Instruments (VIs)Each VI has 2 Windows Front Panel User Interface (UI) Controls = Inputs Indicators = Outputs Block Diagram Graphical Code Data travels on wires from controls through functions to indicators Blocks execute by DataflowLabVIEW Programs Are Called Virtual Instruments (VIs)Controls Palette (Controls & Indicators)Controls Palette (Controls & Indicators)(Place items on the Front Panel Window)Indicator: Numeric SlideControl: NumericCustomize Palette ViewFunctions (and Structures) PaletteFunctions (and Structures) Palette(Place items on the Block Diagram Window)Structure: While LoopTools Palette Recommended: Automatic Selection Tool Tools to operate and modify both front panel and block diagram objects Tools PaletteAutomatically chooses among the following tools:Status ToolbarRun Button Continuous Run Button Abort ExecutionExecution Highlighting ButtonAdditional Buttons on the Diagram ToolbarStatus ToolbarRetain Wire Values ButtonStep Function ButtonsnullDo Not Delete Exercise InstructionsDemonstration 1: Creating a VIBlock Diagram WindowFront Panel WindowDemonstration 1: Creating a VIInput TerminalsOutput TerminalBoolean ControlGraph IndicatornullBlock diagram execution 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 doneDataflow ProgrammingDebugging TechniquesDebugging TechniquesFinding Errors Execution Highlighting ProbesClick on broken Run button. Window showing error appears.Click on Execution Highlighting button; data flow is animated using bubbles. Values are displayed on wires.Right-click on wire to display probe and it shows data as it flows through wire segment. You can also select Probe tool from Tools palette and click on wire.Exercise 2 – Acquiring a Signal with DAQExercise 2 – Acquiring a Signal with DAQTrack A&BThis exercise should take 15 minutes.Use a LabVIEW template to: Acquire a signal from your DAQ deviceDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsExercise 2 – Acquiring a Signal with the Sound CardExercise 2 – Acquiring a Signal with the Sound CardTrack CUse LabVIEW to: Acquire a signal from your sound cardThis exercise should take 15 minutes.Context Help WindowContext Help WindowHelp»Show Context Help, press the keys Hover cursor over object to update windowAdditional Help Right-Click on the VI icon and choose Help, or Choose “Detailed Help.” on the context help windowTips for Working in LabVIEWTips for Working in LabVIEWKeystroke Shortcuts – Activate/Deactivate Context Help Window – Remove Broken Wires From Block Diagram – Toggle Between Front Panel and Block Diagram – Undo (Also in Edit Menu) Tools»Options… – Set Preferences in LabVIEW VI Properties–Configure VI Appearance, Documentation, etc.Blank Page – Do not DeleteBlank Page – Do not DeleteSection II – Elements of Typical ProgramsSection II – Elements of Typical ProgramsA. Loops While Loop For Loop B. Functions and SubVIs Types of Functions Creating Custom Functions (SubVI) Functions Palette & Searching C. Decision Making and File IO Case Structure Select (simple If statement) File I/O LoopsLoopsWhile Loops i terminal counts iteration Always runs at least once Runs until stop condition is metFor Loops i terminal counts iterations Run according to input N of count terminalWhile LoopFor LoopDrawing a LoopDrawing a Loop1. Select the structure2. Enclose code to be repeated3. Drop or drag additional nodes and then wirenull3 Types of Functions (from the Functions Palette)Express VIs: interactive VIs with configurable dialog page (blue border) Standard VIs: modularized VIs customized by wiring (customizable) Functions: fundamental operating elements of LabVIEW; no front panel or block diagram (yellow) What Types of Functions are Available?What Types of Functions are Available?Input and Output Signal and Data Simulation Acquire and Generate Real Signals with DAQ Instrument I/O Assistant (Serial & GPIB) ActiveX for communication with other programs Analysis Signal Processing Statistics Advanced Math and Formulas Continuous Time Solver Storage File I/OExpress Functions PaletteSearching for Controls, VIs, and FunctionsSearching for Controls, VIs, and FunctionsPalettes are filled with hundreds of VIs Press the search button to index the all VIs for text searching Click and drag an item from the search window to the block diagram Double-click an item to open the owning paletteExercise 2.1 – Analysis Exercise 2.1 – Analysis Track A,B,&CUse LabVIEW Express VIs to: Simulate a signal and display its amplitude and frequencyThis exercise should take 15 minutes.Do Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsExercise 2.2 – Analysis Exercise 2.2 – Analysis Track A&BUse LabVIEW Express VIs to: Acquire a signal and display its amplitude and frequencyThis exercise should take 15 minutes.Exercise 2.2 – Analysis Exercise 2.2 – Analysis Track CUse LabVIEW Express VIs to: Acquire a signal and display its amplitude and frequencyThis exercise should take 15 minutes.How Do I Make Decisions in LabVIEW?How Do I Make Decisions in LabVIEW?Case Structures Select (a)(b)(c)File I/OFile I/OFile I/O – Allows recording or reading data in a file. LabVIEW creates or uses the following file formats: Binary: underlying file format of all other file formats ASCII: regular text files LVM: LabVIEW measurement data file TDM: created for National Instruments products High Level File I/O FunctionsHigh Level File I/O Functions Easy to use High Level of abstractionWriting to LVM fileReading from LVM fileExercise 3.3 – Decision Making and Saving DataExercise 3.3 – Decision Making and Saving DataUse a case structure to: Make a VI that saves data when a condition is metThis exercise should take 15 minutes.Track A,B,CnullFile I/O Programming Model – Under the hood Open/ Create/ Replace FileRead and/or Write to FileClose FileCheck for ErrorsSpreadsheet FormattingSpreadsheet FormattingSpreadsheet files are ASCII files with a certain formatting Usually tabs between columns and end of line constants between rows LabVIEW includes VIs that perform this formatting or a string can be concatenatedDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsSection III – Presenting your ResultsSection III – Presenting your ResultsA. Displaying Data on the Front Panel Controls and Indicators Graphs and Charts Loop Timing B. Signal Processing MathScript Arrays Clusters WaveformsWhat Types of Controls and Indicators are Available?What Types of Controls and Indicators are Available?Numeric Data Number input and display Analog Sliders, Dials, and Gauges Boolean Data Buttons and LEDs Array & Matrix Data Numeric Display Chart Graph XY Graph Intensity Graph 3D graph: point, surface, and model Decorations Tab Control Arrows Other Strings and text boxes Picture/Image Display ActiveX ControlsExpress Controls PaletteCharts – Add 1 data point at a time with historyCharts – Add 1 data point at a time with historyWaveform chart – special numeric indicator that can display a history of values Chart updates with each individual point it receivesFunctions»Express»Graph Indicators»ChartGraphs – Display many data points at onceGraphs – Display many data points at onceWaveform graph – special numeric indicator that displays an array of data Graph updates after all points have been collected May be used in a loop if VI collects buffers of data Functions»Express»Graph Indicators»GraphBuilding Arrays with Loops (Auto-Indexing)Loops can accumulate arrays at their boundaries with auto-indexing For Loops auto-index by default While Loops output only the final value by default Right-click tunnel and enable/disable auto-indexingBuilding Arrays with Loops (Auto-Indexing)Wire becomes thickerWire remains the same sizeAuto-Indexing DisabledAuto-Indexing EnabledOnly one value (last iteration) is passed out of the loop1D Array0 1 2 3 4 55Creating an Array (Step 1 of 2)Creating an Array (Step 1 of 2)From the Controls»Modern»Array, Matrix, and Cluster subpalette, select the Array icon.Drop it on the Front Panel.Create an Array (Step 2 of 2)Create an Array (Step 2 of 2)Place an Array Shell. Insert datatype into the shell (i.e. Numeric Control).How Do I Time a Loop?How Do I Time a Loop?1. Loop Time Delay Configure the Time Delay Express VI for seconds to wait each iteration of the loop (works on For and While loops). 2. Timed Loops Configure special timed While loop for desired dt. Timed LoopTime DelayControl & Indicator PropertiesControl & Indicator PropertiesProperties are characteristics or qualities about an object Properties can be found by right clicking on a Control or Indicator Properties Include: Size Color Plot Style Plot color Features include: Cursors ScalingExercise 3.1 – Manual AnalysisExercise 3.1 – Manual AnalysisTrack A,B,&CUse the cursor legend on a graph to: Verify your frequency and amplitude measurementsThis exercise should take 15 minutes.Textual Math in LabVIEWTextual Math in LabVIEWIntegrate existing scripts with LabVIEW for faster development Interactive, easy-to-use, hands-on learning environment Develop algorithms, explore mathematical concepts, and analyze results using a single environment Freedom to choose the most effective syntax, whether graphical or textual within one VI Supported Math Tools: MathScript script node MathSoft software Mathematica software MATLAB® software Maple software Xmath softwareMATLAB ® is a registered trademark of The MathWorks, Inc.Math with the MathScript NodeMath with the MathScript NodeImplement equations and algorithms textually Input and Output variables created at the border Generally compatible with popular m-file script language Terminate statements with a semicolon to disable immediate outputPrototype your equations in the interactive MathScript Window.(Functions»Programming» Structures»MathScript)The Interactive MathScript WindowThe Interactive MathScript WindowRapidly develop and test algorithms (LabVIEW»Tools»MathScript Window)Output WindowVariable WorkspaceView/Modify Variable ContentsUser CommandsShare Scripts and Variables with the Node View /Modify Variable content in 1D, 2D, and 3DExercise 3.2 – Using MathScriptExercise 3.2 – Using MathScriptUse the MathScript Node and Interactive Window to process the acquired signal (logarithmic decay) in the MathScript and save the script.Track A,B,&CThis exercise should take 25 minutes.Do Not DeleteDo Not DeleteExercise InstructionsDo Not DeleteDo Not DeleteExercise InstructionsReview of Data Types Found in LabVIEWReview of Data Types Found in LabVIEWExercise 3.3 – Apply What You Have Learned Exercise 3.3 – Apply What You Have Learned Track A,B,&CThis exercise should take 20 minutes.Section IV – Additional LabVIEW TopicsSection IV – Additional LabVIEW TopicsAdditional Data types Cluster Data Flow Constructs Shift Register SubVIs State Machines Local Variables Producer/ConsumerIntroduction to ClustersIntroduction to ClustersData structure that groups data together Data may be of different types Analogous to struct in C Elements must be either all controls or all indicators Thought of as wires bundled into a cable Order is importantCreating a ClusterCreating a ClusterSelect a Cluster shell. Controls»Modern»Array, Matrix & Cluster2. Place objects inside the shell.Cluster FunctionsCluster FunctionsIn the Cluster & Variant subpalette of the Programming palette Can also be accessed by right-clicking the cluster terminalBundle(Terminal labels reflect data type)Bundle By NameUsing Arrays and Clusters with GraphsUsing Arrays and Clusters with GraphsThe Waveform Datatype contains 3 pieces of data: t0 = Start Time dt = Time between Samples Y = Array of Y magnitudes Two ways to create a Waveform Cluster:Build Waveform (absolute time)Cluster (relative time)Shift Register – Access Previous Loop DataShift Register – Access Previous Loop Data• Available at left or right border of loop structures • Right-click the border and select Add Shift Register • Right terminal stores data on completion of iteration • Left terminal provides stored data at beginning of next iterationBefore Loop BeginsFirst IterationSecond Iteration Last Iteration Value 3Initial ValueModularity in LabVIEW – SubVIs Modularity in LabVIEW – SubVIs Convert repeated functions and VIs with a single VICreate SubVICreate SubVIEnclose area to be converted into a subVI. Select Edit»Create SubVI from the Edit Menu.LabVIEW Functions and SubVIs operate like Functions in other languagesLabVIEW Functions and SubVIs operate like Functions in other languagesFunction Pseudo Code function average (in1, in2, out) { out = (in1 + in2)/2.0; } SubVI Block DiagramCalling Program Pseudo Code main { average (in1, in2, pointavg) } Calling VI Block DiagramIcon and Connector PaneIcon and Connector PaneUse this connector pane layout as a standard Top terminals are usually reserved for references, such as a file reference Bottom terminals are usually reserved for error clustersIcon and Connector Pane – Create IconIcon and Connector Pane – Create IconCreate custom icons by right-clicking the icon in the upper right corner of the front panel or block diagram and selecting Edit Icon or by double-clicking the icon You also can drag a graphic from anywhere in your file system and drop it on the icon Refer to the Icon Art Glossary at ni.com for standard graphics to use in a VI iconDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsState MachinesState MachinesWhile Loop Case Structure Shift RegisterState Machines TransitionsState Machines Transitions Several programming techniques exist for transitioning from state to state in LabVIEW using State Machines Default transition implies that after one state, another state always follows Transitions between two potential states can be handled by a Select FunctionCommunicating between loopsCommunicating between loopsCommunicating between loops using data flow is not possible The left loop will execute completely before the right loop Variables are needed when communication with wires does not give the desired behaviorLocal VariablesLocal Variables Local Variables allow data to be passed between parallel loops. A single control or indicator can be read or written to from more than one location in the program Local Variables break the dataflow paradigm and should be used sparinglyCreating a Local Variable - Walk ThroughCreating a Local Variable - Walk ThroughIn this example we will see how Local Variables allow us to share data between parallel loops. We will create a program that toggles two separate LEDs using one switch. It also stops two loops with one button. Create the block diagram and front panel as seen to the right. Creating Local VariablesCreating Local VariablesRight-click on the Stop Button in the Front Panel and change the Mechanical Action to “Switch When Released” since Local Variables cannot store Latched data.Producer/Consumer Design PatternProducer/Consumer Design PatternV. Large Program DevelopmentV. Large Program DevelopmentNavigation Window LabVIEW Project Shared VariableLabVIEW Navigation WindowLabVIEW Navigation WindowShows the current region of view compared to entire Front Panel or Block Diagram Great for large programs * Organize and reduce program visual size with subVIsLabVIEW ProjectLabVIEW ProjectGroup and organize VIs Hardware and I/O management Manage VIs for multiple targets Build libraries and executables Manage large LabVIEW applications Enable version tracking and management (LabVIEW»Project»New)Shared VariablesShared VariablesShared Variables are used to send data between VIs. Variable Types: Single Process: share the data among VIs on the local computer. Network-published: communicate between VIs, remote computers, and hardware through the Shared Variable Engine. Shared Variable must exist within a project library. Shared Variable must be deployed to be available to other projects and remote computers. Do Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsDo Not Delete Exercise InstructionsSection VI - Instrument ControlSection VI - Instrument ControlOverview of Instrument Control GPIB Serial Instrument I/O Assistant VISA Instrument Drivers and IDNETWhat Types of Instruments Can Be Controlled?What Types of Instruments Can Be Controlled?GPIB Serial Modular Instruments P
本文档为【Introduction to LabVIEW 8 in 6 Hours】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_212831
暂无简介~
格式:ppt
大小:6MB
软件:PowerPoint
页数:0
分类:工学
上传时间:2014-01-15
浏览量:19