版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、3-Hour Hands-OnIntroduction to LabVIEWCourse GoalsBecome comfortable with the LabVIEW environment and data flow executionAbility to use LabVIEW to solve problemsLabVIEW ConceptsAcquiring, saving and loading dataFind and use math and complex analysis functionsWork with data types, such as arrays and
2、clustersDisplaying and printing resultsThe Virtual Instrumentation ApproachLabVIEW Graphical Development SystemGraphical Programming EnvironmentCompile code for multiple OS and devicesUseful in a broad range of applicationsVirtual Instrumentation Applications Design Signal and Image Processing Embed
3、ded 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 moreDesignPrototypeDeployA single graphical develop
4、ment platformThe NI Approach Integrated Hardware PlatformsHigh-SpeedDigitizersHigh-ResolutionDigitizers and DMMsMultifunction Data AcquisitionDynamicSignal AcquisitionDigital I/OInstrumentControlCounter/TimersMachineVisionMotion ControlDistributed I/O andEmbedded ControlLaptop PCPDADesktop PCPXI Mod
5、ular InstrumentationSignal Conditioningand SwitchingUnit Under TestSection I LabVIEW EnvironmentA. Getting Data into your Computer Data Acquisition Devices NI-DAQ Simulated Data Acquisition Sound CardB. LabVIEW Environment Front Panel / Block Diagram Toolbar /Tools PaletteC. Components of a LabVIEW
6、Application Creating a VI Data Flow ExecutionD. Additional Help Finding Functions Tips for Working in LabVIEWA. Setting Up Your Hardware Data Acquisition Device (DAQ) Actual USB, PCI, or PXI Device Configured in MAX Simulated Data Acquisition Device (DAQ) Software simulated at the driver level Confi
7、gured in MAX Sound Card Built into most computersDo Not DeleteNotes on hardware setupWhat type of device should I use? Sound Card*NI USB DAQNI PCI DAQInstruments*AI Bandwidth844 KS/s10200 KS/s250 K1.2 Ms/s20kS/s2 GS/sAccuracy1216 bit1216 bit1418 bit1224 bitPortablexxsomeAI Channels281616802AO Channe
8、ls212240AC or DCACAC/DCAC/DCAC/DCTriggeringxxxCalibratedxxx* The above table may not be representative of all device variations that exist in each categoryWhat is MAX? MAX stands for Measurement & Automation Explorer. MAX configures and organizes all your National Instruments DAQ, PCI/PXI instru
9、ments, GPIB, IMAQ, IVI, Motion, VISA, and VXI devices. Used for configuring and testing devices.Exercise 1 Setting Up Your DeviceUse Measurement and Automation Explorer (MAX) to:Configure and test your Data Acquisition (DAQ) deviceDo Not DeleteExercise InstructionsExercise 1 Setting Up Your DeviceUs
10、e Measurement and Automation Explorer (MAX) to: Configure and test your Simulated Data Acquisition (DAQ) deviceDo Not DeleteExercise InstructionsExercise 1 Setting Up Your DeviceUse Windows to:Verify your Sound CardUn-Mute MicrophoneStartAll ProgramsNational Instruments LabVIEW 8.0Startup Screen:Sta
11、rt from a Blank VI:NewBlank VIStart from an Example:ExamplesFind ExamplesorOpen and Run LabVIEWEach VI has 2 WindowsFront Panel User Interface (UI) Controls = Inputs Indicators = OutputsBlock Diagram Graphical Code Data travels on wires from controls through functions to indicators Blocks execute by
12、 DataflowLabVIEW Programs Are Called Virtual Instruments (VIs)Controls Palette(Controls & Indicators)(Place items on the Front Panel Window)Indicator:Numeric SlideControl:NumericCustomize Palette ViewFunctions (and Structures) Palette(Place items on the Block Diagram Window)Structure:While Loop
13、Recommended: Automatic Selection Tool Tools to operate and modify both front panel and block diagram objectsOperating ToolPositioning/Resizing ToolLabeling ToolWiring ToolTools PaletteAutomatic Selection ToolAutomatically chooses among the following tools:Run Button Continuous Run ButtonAbort Execut
14、ionExecution Highlighting ButtonAdditional Buttons on the Diagram ToolbarStatus ToolbarRetain Wire Values ButtonStep Function ButtonsDo Not DeleteExercise InstructionsBlock Diagram WindowFront Panel WindowDemonstration 1: Creating a VIInputTerminalsOutputTerminalBooleanControlGraphIndicator Block di
15、agram 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 Techniques Finding Errors Execution Highlighting ProbesClick on brok
16、en 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 o
17、n wire.Exercise 2 Acquiring a Signal with DAQThis exercise should take 15 minutes. Use a LabVIEW template to: Acquire a signal from your DAQ deviceDo Not DeleteExercise InstructionsDo Not DeleteExercise InstructionsDo Not DeleteExercise InstructionsExercise 2 Acquiring a Signal with the Sound Card U
18、se LabVIEW to: Acquire a signal from your sound cardThis exercise should take 15 minutes.Context Help WindowHelpShow Context Help, press the keysHover cursor over object to update windowAdditional HelpRight-Click on the VI icon and choose Help, orChoose “Detailed Help.” on the context help windowTip
19、s 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)ToolsOptions Set Preferences in LabVIEWVI PropertiesConfigure VI Appearance, Documentation, etc.Blank Page D
20、o not DeleteSection II Elements of Typical ProgramsA. Loops While Loop For LoopB. Functions and SubVIs Types of Functions Creating Custom Functions (SubVI) Functions Palette & SearchingC. Decision Making and File IO Case Structure Select (simple If statement) File I/OLoopsWhile Loops i terminal
21、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 terminalDrawing a Loop1. Select the structure2. Enclose code to be repeated3. Drop or drag additional nodes and then wire3 Types of Functions (from the
22、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? Input and Ou
23、tput 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 PaletteSearc
24、hing for Controls, VIs, and Functions Palettes 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 paletteCreate SubVI Enclose area to be converted i
25、nto a subVI. Select EditCreate SubVI from the Edit Menu.LabVIEW Functions and SubVIs operate like Functions in other languagesFunction Pseudo Codefunction average (in1, in2, out)out = (in1 + in2)/2.0;SubVI Block DiagramCalling Program Pseudo Codemainaverage (in1, in2, pointavg)Calling VI Block Diagr
26、amExercise 3.1 Analysis Use LabVIEW Express VIs to:Simulate a signal and display its amplitude and frequencyThis exercise should take 15 minutes.Do Not DeleteExercise InstructionsExercise 3.2 Analysis Use LabVIEW Express VIs to:Acquire a signal and display its amplitude and frequencyThis exercise sh
27、ould take 15 minutes.Exercise 3.2 Analysis Use 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?1.Case Structures2.Select(a)(b)(c)File I/OFile I/O passing data to and from files Files can be binary,
28、 text, or spreadsheet Write/Read LabVIEW Measurements file (*.lvm)Exercise 3.3 Decision Making and Saving Data Use a case structure to:Make a VI that saves data when a condition is metThis exercise should take 15 minutes.File I/O Programming Model Under the hoodOpen/Create/Replace FileRead and/orWri
29、te to FileClose FileCheck forErrorsSection III Presenting your ResultsA. Displaying Data on the Front Panel Controls and Indicators Graphs and Charts Loop TimingB. Signal Processing MathScript Arrays Clusters WaveformsWhat Types of Controls and Indicators are Available? Numeric Data Number input and
30、 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
31、 PaletteCharts 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 receivesFunctionsExpressGraph IndicatorsChartGraphs Display many data points at onceWaveform graph special numeric indicator
32、 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 dataFunctionsExpressGraph IndicatorsGraph Loops can accumulate arrays at their boundaries with auto-indexing For Loops auto-index by default While Loops output only the
33、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
34、(Step 1 of 2)From the ControlsModernArray, Matrix, and Cluster subpalette, select the Array icon.Drop it on the Front Panel.Create an Array (Step 2 of 2)1. Place an Array Shell.2. Insert datatype into the shell (i.e. Numeric Control).How Do I Time a Loop?1. Loop Time Delay Configure the Time Delay E
35、xpress 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 Properties Properties are characteristics or qualities about an object Properties can be found by right
36、 clicking on a Control or Indicator Properties Include:SizeColorPlot StylePlot color Features include:CursorsScalingExercise 4.1 Manual AnalysisUse the cursor legend on a graph to:Verify your frequency and amplitude measurementsThis exercise should take 15 minutes.Textual Math in LabVIEW Integrate e
37、xisting 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 VISupport
38、ed Math Tools:MathScript script nodeMathSoft softwareMathematica softwareMATLAB softwareMaple software Xmath softwareMATLAB is a registered trademark of The MathWorks, Inc.Math with the MathScript Node Implement equations and algorithms textually Input and Output variables created at the border Gene
39、rally compatible with popular m-file script language Terminate statements with a semicolon to disable immediate outputPrototype your equations in the interactive MathScript Window.(FunctionsProgrammingStructuresMathScript)The Interactive MathScript Window Rapidly develop and test algorithms (LabVIEW
40、ToolsMathScript Window)OutputWindowVariableWorkspaceView/ModifyVariable ContentsUser Commandsm-file Script Share Scripts and Variables with the Node View /Modify Variable content in 1D, 2D, and 3DExercise 4.2 Using MathScriptUse the MathScript Node and Interactive Window to process the acquired sign
41、al (logarithmic decay) in the MathScript and save the script.This exercise should take 25 minutes.Do Not DeleteExercise InstructionsDo Not DeleteExercise InstructionsReview of Data Types Found in LabVIEWExercise 5 Apply What You Have LearnedThis exercise should take 20 minutes.Section IV Advanced Da
42、ta Flow Topics (optional)A. Additional Data types ClusterB. Data Flow Constructs Shift Register Local VariablesC. Large Application Development Navigator Window LabVIEW ProjectsIntroduction to ClustersData structure that groups data togetherData may be of different typesAnalogous to struct in CEleme
43、nts must be either all controls or all indicatorsThought of as wires bundled into a cable Order is importantCreating a Cluster1.Select a Cluster shell.ControlsModernArray, Matrix & Cluster2. Place objects inside the shell.Cluster Functions In the Cluster & Variant subpalette of the Programmi
44、ng palette Can also be accessed by right-clicking the cluster terminalBundle(Terminal labels reflect data type)Bundle By NameUsing Arrays and Clusters with GraphsThe Waveform Datatype contains 3 pieces of data: t0 = Start Time dt = Time between Samples Y = Array of Y magnitudesTwo ways to create a W
45、aveform Cluster:Build Waveform (absolute time)Cluster (relative time)Shift 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
46、data at beginning of next iterationBefore LoopBeginsFirst IterationSecondIteration LastIteration Value 3InitialValueLocal 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
47、 Variables break the dataflow paradigm and should be used sparingly Shows the current region of view compared to entire Front Panel or Block Diagram Great for large programsLabVIEW Navigation Window* Organize and reduce program visual size with subVIsLabVIEW ProjectGroup and organize VIsHardware and I/O managementManage VIs for multiple targetsBuild libraries and executablesManage large LabVIEW applicationsEnable version tracking and management(LabVIEWProjectNew)Additional Resources NI Academic Web & Student C
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025機械設備的買賣合同
- 洛陽理工學院《工科大學化學-物理化學(二)》2023-2024學年第一學期期末試卷
- 污水處理廠導向鉆進施工合同
- 墻繪施工合同范本
- 教育培訓機構勞務管理
- 食品企業(yè)財務健康檢查
- 2024年動力煤進口清關共享成功之道!3篇
- 廣西壯族自治區(qū)河池市2023-2024學年高一上學期1月期末考試數學試題(解析版)
- 醫(yī)療器械招投標管理規(guī)范
- 醫(yī)藥招投標項目招標文件編制
- 國家開放大學電大《建筑制圖基礎》機考三套標準題庫及答案3
- 降低故障工單回復不合格率
- 可涂色簡筆畫打印(共20頁)
- 燈光架介紹及使用說明
- 十一學校行動綱要
- GB 1886.6-2016 食品安全國家標準 食品添加劑 硫酸鈣(高清版)
- 關于房屋征收及土地收儲過程中的稅收政策(僅供參考)
- 唯一住房補貼申請書(共2頁)
- 單面多軸鉆孔組合機床動力滑臺液壓系統(tǒng)課程設計
- 中醫(yī)養(yǎng)生脾胃為先PPT文檔
- 門窗工程成品保護方案(附圖)
評論
0/150
提交評論