收藏 分享(赏)

Virtual Instrumentation With LabVIEW.ppt

上传人:精品资料 文档编号:5045100 上传时间:2019-02-02 格式:PPT 页数:90 大小:3.24MB
下载 相关 举报
Virtual Instrumentation With LabVIEW.ppt_第1页
第1页 / 共90页
Virtual Instrumentation With LabVIEW.ppt_第2页
第2页 / 共90页
Virtual Instrumentation With LabVIEW.ppt_第3页
第3页 / 共90页
Virtual Instrumentation With LabVIEW.ppt_第4页
第4页 / 共90页
Virtual Instrumentation With LabVIEW.ppt_第5页
第5页 / 共90页
点击查看更多>>
资源描述

1、Virtual Instrumentation With LabVIEW,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,Section I,LabVIEW terms Components of a LabVIEW application LabVIEW programmin

2、g tools Creating an application in LabVIEW,Front Panel Controls = Inputs Indicators = OutputsBlock Diagram Accompanying “program” for front panel Components “wired” together,LabVIEW Programs Are Called Virtual Instruments (VIs),Boolean Control,Double Indicator,Waveform Graph,Panel Toolbar,VI Front P

3、anel,VI Block Diagram,Numeric Constant,Thermometer Terminal,Call to subVI,While Loop,Knob Terminal,Stop Button Terminal,Stop Loop Terminal,Temperature Graph,Controls and Functions Palettes,Graphical, floating palettesUsed to place controls & indicators on the front panel, or to build the block diagr

4、am,Controls Palette(Panel Window),Functions Palette(Diagram Window),Operating Tool Positioning/Resizing Tool Labeling Tool Wiring Tool Shortcut Menu Tool,Floating Palette Used to operate and modify front panel and block diagram objects.,Scrolling Tool Breakpoint Tool Probe Tool Color Copy Tool Color

5、ing Tool,Tools Palette,Automatic Selection Tool,Run Button Continuous Run ButtonAbort ExecutionPause/Continue ButtonText SettingsAlign ObjectsDistribute ObjectsReorder,Execution Highlighting ButtonStep Into ButtonStep Over ButtonStep Out Button,Additional Buttons on the Diagram Toolbar,Status Toolba

6、r,Do Not Delete This Slide,Signal Generationand Processing.viHelp Find Examples Browse According to: Task Analyzing and Processing Signals Signal Processing Signal Generation and Processing.vi,Open and Run a Virtual Instrument,Control Terminals,Block Diagram Window,Front Panel Window,Indicator Termi

7、nals,Creating a VI,Creating a VI Block Diagram,After Creating Front Panel Controls and Indicators, Switch to Block Diagram Move Front Panel Objects to Desired Locations Using the Position/Size/Select Tool Place Functions On Diagram Wire Appropriate Terminals Together to Complete the Diagram,Wiring T

8、ips Block Diagram,Wiring “Hot Spot”,Click While Wiring To Tack Wires Down,Spacebar Flips Wire Orientation,Click To Select Wires,Do Not Delete This Slide,Dataflow Programming,Block diagram does NOT execute left to rightNode executes when data is available to ALL input terminalsNodes supply data to al

9、l output terminals when done,Help Options,Context Help Online help Lock help Simple/Complex Diagram help Ctrl + HOnline reference All menus online Pop up on functions in diagram to access online info directly,Do Not Delete This Slide,Exercise 1 - Convert C to F,Debugging Techniques,Finding ErrorsExe

10、cution HighlightingProbe,Click 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 segmentYou can also select Prob

11、e tool from Tools palette and click on wire,Section II SubVIs,What is a subVI? Making an icon and connector for a subVI Using a VI as a subVI,SubVIs,A SubVI is a VI that can be used within another VI Advantages Modular Easier to debug Dont have to recreate code Require less memory,Icon and Connector

12、,An icon represents a VI in other block diagrams A connector shows available terminals for data transfer,SubVIs,SubVIs,Steps to Create a SubVI,Create the Icon Create the Connector Assign Terminals Save the VI Insert the VI into a Top Level VI,Create the Icon,Right-click on the icon in the diagram or

13、 front panel,Create the Connector,Right click on the icon pane (front panel only),Assign Terminals,Save The VI,Choose an Easy to Remember Location Organize by Functionality Save Similar VIs into one directory (e.g. Math Utilities) Organize by Application Save all VIs Used for a Specific Application

14、into one directory or library file (e.g. Lab 1 Frequency Response) Library Files (.llbs) combine many VIs into a single file, ideal for transferring entire applications across computers,Insert the SubVI into a Top Level VI,Accessing user-made subVIsFunctions Select a VI Or Drag icon onto target diag

15、ram,Tips for Working in LabVIEW,Keystroke Shortcuts Activate/Deactivate Context Help Window Remove Broken Wires From Block Diagram Toggle Between Front Panel and Block Diagram Undo (Also in Edit Menu) Tab Key Toggle Through Tools on Toolbar Tools Options Set Preferences in LabVIEW VI Properties Conf

16、igure VI Appearance, Documentation, etc.,Section III Data Acquisition,Data acquisition (DAQ) basics Connecting Signals Simple DAQ application,Sensors,DAQ Data Acquisition,Plug-in board for a computer with: Analog input channels Analog output channels Counters Digital I/O Controlled by a suite of Lab

17、VIEW VIs FunctionsData Acquisition,DAQ Data Acquisition,Simple Temperature Acquisition ExampleTwo parameters Device = 1 Channel = 0,Data Acquisition Terminology,Resolution - Determines How Many Different Voltage Changes Can Be Measured Larger Resolution More Precise Representation of Signal Range -

18、Minimum and Maximum Voltages Smaller range More Precise Representation of Signal Gain - Amplifies or Attenuates Signal for Best Fit in Range,Do Not Delete This Slide,Hardware Connections,BNC-2120,SCB-68,SC-2075,Exercise 2 Simple Data Acquisition,Complete Convert C to F.vi, then create Thermometer.vi

19、.,Do Not Delete This Slide,Section IV Loops and Charts,For Loop While Loop Charts Multiplots,Loops,While Loops Have Iteration Terminal Always Run Once Run According to Continue Terminal,For Loops Have Iteration Terminal Run According to input N,Loops (cont.),For Loop,Select the loop Enclose Code to

20、Repeat,Charts,Waveform chart special numeric indicator that can display a history of values Controls Graphs Waveform Chart,Wiring Data into Charts,Single Plot Charts,Multiplot Charts,Exercise 3 Monitoring Temperature,Students build Temperature Monitor.vi.,Section V Arrays & File I/O,Build arrays man

21、ually Have LabVIEW build arrays automatically Write to a spreadsheet file Read from a spreadsheet file,Adding an Array to the Front Panel,From the Controls Array and Cluster subpalette, select the Array Shell,Drop it on the screen.,Adding an Array (cont.),Place data object into shell (e.g. digital c

22、ontrol).,Creating an Array with a Loop,Loops accumulate arrays at their boundaries,Creating 2D Arrays,File I/O,Read/write to spreadsheet fileRead/write characters to file (ASCII)Read lines from fileRead/write binary file,Easy File I/O VIs,Do Not Delete This Slide,File I/O Example,Writing a 2D Array

23、to File,File I/O Example,Reading a 2D Array from a File,Exercise 4 Analyzing and Logging Data,Students build Temperature Logger.vi,Section VI Array Functions & Graphs,Basic Array Functions Use graphs Create multiplots with graphs,Array Functions Basics,Array Functions Build Array,Graphs,Selected fro

24、m the Graph palette of Controls menu,Waveform Graph Plot an array of numbers against their indices XY Graph Plot one array against another Digital Waveform Graph Plot bits from binary data,Do Not Delete This Slide,Graphs,Right-Click on the Graph to Customize,Exercise 5 Using Waveform Graphs,Section

25、VII Strings, Clusters, & Error Handling,Strings,A string is a sequence of displayable or nondisplayable characters (ASCII) Many uses displaying messages, instrument control, file I/O String control/indicator is in the ControlsString subpalette,Clusters,Data structure that groups data together Data m

26、ay 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,Creating a Cluster,1. Select a Cluster shell from the Array & Cluster subpalette,2. Place objects inside the shell,Cluster Functions,In the Cluster subpal

27、ette of the Functions palette Can also be accessed by right-clicking on the cluster terminal,Bundle,(Terminal labels reflect data type),Bundle By Name,Cluster Functions,Unbundle,Unbundle By Name,Unbundled cluster in the diagram,Error Clusters,Error cluster contains the following information: Boolean

28、 to report whether error occurred Integer to report a specific error code String to give information about the error,Error Handling Techniques,Error information is passed from one subVI to the next If an error occurs in one subVI, all subsequent subVIs are not executed in the usual manner Error Clus

29、ters contain all error conditions,error clusters,Section VIII - Case & Sequence Structures, Formula Nodes,Case Structures,In the Structures subpalette of Functions palette Enclose nodes or drag them inside the structure Stacked like a deck of cards, only one case visible,Exercise 6 Error Clusters &

30、Handling,Sequence Structures,In the Structures subpalette of Functions palette Executes diagrams sequentially, Frame 0 (0x), where x is the total number of frames Stacked like a deck of cards, only one frame visible,Sequence Locals,Pass data from one frame to future frames Created at the border of t

31、he Sequence structure,Sequence local created in Frame 1,Data not available,Data available,Formula Nodes,In the Structures subpalette Implement complicated equations Variables created at border Variable names are case sensitive Each statement must terminate with a semicolon (;) Context Help Window sh

32、ows available functions,Note semicolon,Section IX Printing & Documentation,Print From File Menu to Printer, HTML, Rich Text File Programmatically Print Graphs or Front Panel Images Document VIs in VI Properties Documentation Dialog Add Comments Using Free Labels on Front Panel & Block Diagram,Printi

33、ng,File Print Gives Many Printing Options Choose to Print Icon, Front Panel, Block Diagram, VI Hierarchy, Included SubVIs, VI History Print Panel.vi (Functions Application Control) Programmatically Prints a Front Panel Generate & Print Reports (Functions Report Generation) Search in Find Examples fo

34、r Report Generation,Documenting VIs,VI Properties Documentation Provide a Description and Help Information for a VI VI Properties Revision History Track Changes Between Versions of a VIIndividual Controls Description and Tip Right Click to Provide Description and Tip Strip Use Labeling Tool to Docum

35、ent Front Panels & Block Diagrams,Section X Basic Programming Architecture,Simple VI Architecture General VI Architecture State Machine Architecture,Simple VI Architecture,Functional VI that produces results when run No “start” or “stop” options Suitable for lab tests, calculations Example: Convert

36、C to F.vi,General VI Architecture,Three Main Steps Startup Main Application Shutdown,State Machine Architecture,Advantages Can go from any state from any other Easy to modify and debug Disadvantages Can lose events if two occur at the same time,States: 0: Startup 1: Idle 2: Event 1 3: Event 2 4: Shu

37、tdown,Exercise 7 Simple State Machine,Do Not Delete This Slide,Section XI Remote Front Panels,View & Control LabVIEW Front Panels from a Web Browser Requires no programming Remote clients see “live” front panel updates Multiple clients can view the same panel simultaneously Only one client can contr

38、ol the front panel at a time,Remote Panel Web Publishing Tool,Tools Web Publishing Tool,Click Save to Disk and VI is Embedded into an Html File After File is Saved, It Can Be Reopened and Customized in Any Html Editor,Remote Front Panels - Resources,NI Developer Zone () Search for Remote Front Panel

39、 Tutorials & Instructions Are Available for Download Information on Incorporating Web Cameras into Remote Panel Applications,Section XII Additional Topics,Property Nodes Local Variables Global Variables DataSocket Binary File I/O,Where Do I Go From Here?,Example programs (Help Find Examples) LabVIEW Student Edition ( Web resources () NI Developer Zone () Application Notes Info-labview newsgroup (www.info-labview.org/) Instrument Driver Library (

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报