版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、How to Use this Slide Deck,Whats Included? Instructional and exercise slides for the LabVIEW Student Ambassadors End of lesson quiz questions Exercises that are designated “Homework” exercises Whats Excluded? Sections involving hardware,Last Updated 08.20.2015,LabVIEW Core 1,3,Course Learning Map,We
2、lcome to LabVIEW Core 1,4,Lesson 6 Using Decision-Making Structures,Learn to create different decision-making structures and be able to identify applications where using these structures can be beneficial.,Case Structures Event-Driven Programming,5,B. Event-Driven Programming,Recognize basic feature
3、s and functionality of event structures.,Event-Driven Scenario Polling Versus Events Event-Driven Programming,Configuring the Event Structure Caveats and Recommendations,6,7,Event-Driven Scenario,Polling Versus Events,Polling,Events,B. Event-Driven Programming,8,9,Event-Driven Programming,Configurin
4、g the Event Structure,B. Event-Driven Programming,10,Edit Events Dialog Box,B. Event-Driven Programming,Events,Event Sources,Configured Events,11,Notify and Filter Events,Notify Events (green arrow) Filter Events (red arrow),B. Event-Driven Programming,12,Demonstrate configuring and using an Event s
5、tructure.,Configure and Use Events,13,14,Convert a polling-based application to an Event structure-based application,Exercise 6-2,Converting a Polling Design to an Event Structure Design,Exercise 6-2,15,How many times did the loop run with polling? How many times did the loop run when you changed th
6、e VI to use an Event structure?,Converting a Polling Design to an Event Structure Design,Caveats and Recommendations,Place only one Event structure in a loop. Use a Value Change event to detect value changes. Keep event handling code short and quick. Place Boolean control terminals inside an event c
7、ase for latched operations to work properly. Avoid using an Event structure outside of a loop. Avoid configuring two Event structures for the same event.,B. Event-Driven Programming,16,Think about the VIs that you will need to develop at your job.,Will you use event-based programming to implement an
8、y of your VIs? Why or why not?,B. Event-Driven Programming,17,Activity 6-2,18,Lesson Review,Refer to the participant guide to answer questions about what you have learned in this lesson and then discuss the answers as a group.,Which of the following can NOT be used as the case selector input to a Ca
9、se structure?,19,Error cluster Array Enum String,Lesson Review,Which of the following can NOT be used as the case selector input to a Case structure?,20,Error cluster Array Enum String,Lesson Review,How many events can an Event structure handle each time it executes?,21,As many as have occurred sinc
10、e the last time the event structure executed One per configured event case One,Lesson Review,How many events can an Event structure handle each time it executes?,22,As many as have occurred since the last time the event structure executed One per configured event case One,Lesson Review,Which stateme
11、nts about event-driven programming versus polling are true?,23,Events execute on demand. Event-driven programming is less CPU-intensive. Event structures handle all events in the order the occur. Polling may fail to detect a change.,Lesson Review,Which statements about event-driven programming versu
12、s polling are true?,24,Events execute on demand. Event-driven programming is less CPU-intensive. Event structures handle all events in the order the occur. Polling may fail to detect a change.,Lesson Review,Lesson 7Modularity,Recognize the benefits of reusing code and create a subVI with a properly
13、configured connector pane, meaningful icon, documentation, and error handling.,Understanding Modularity Icon Connector Pane Documentation Using SubVIs,25,A. Understanding Modularity,Recognize the benefit of using modular code and identify sections of code that could be reused.,Modularity SubVIs,26,M
14、odularity and SubVIs,A. Understanding Modularity,27,SubVIsReusing Code,B. Understanding Modularity,28,SubVIs,B. Understanding Modularity,29,B. Icon,Recognize characteristics of a good icon and use the LabVIEW Icon Editor to create a custom icon.,Characteristics of a Good Icon Using the Icon Editor,3
15、0,Purpose of Icon,Graphical representation of a VI Identifies the subVI on the block diagram of the VI,B. Icon,31,Characteristics of a Good Icon,Good icons convey the functionality of the VI.,B. Icon,32,Creating IconsIcon Editor,B. Icons,33,Use the LabVIEW Icon Editor to create a custom icon.,34,Cre
16、ating an Icon,C. Connector Pane,Select and configure a connector pane for a subVI.,Patterns Standards,35,Patterns,Displayed next to icon Select from different patterns,C. Connector Pane,36,Assigning Terminals,C. Connector Pane,37,Current Temperature,Max Temperature,Min.Temperature,Error In,Warning?,
17、Warning Text,Error Out,Standards,C. Connector Pane,38,D. Documentation,Explain how to document code in LabVIEW using descriptions and tip strips, and describe four methods for documenting code on the block diagram.,VI Descriptions and Tip Strips Labels,39,Creating Descriptions and Tip Strips,D. Docu
18、mentation,40,Documenting Block Diagram Code,D. Documentation,Owned label,Free label,41,E. Using SubVIs,Demonstrate how to place subVIs on the block diagram, explain terminal settings and error handling, and create subVIs from a section of existing code.,Placing SubVIs on the Block Diagram Terminal S
19、ettings Handling Errors Creating from a Section of Block Diagram,42,Placing SubVIs on the Block Diagram,E. Using SubVIs,43,Terminal Settings,Bold Required terminal Plain Recommended terminal Dimmed Optional terminal,E. Using SubVIs,44,Handling Errors,45,Use a Case Structure to handle errors passed i
20、nto the subVI.,E. Using SubVIs,Handling Errors,46,Avoid using LabVIEW error handler VIs inside subVIs.,E. Using SubVIs,Convert a Section of a VI to SubVI,Select the section of the block diagram to reuse. Select EditCreate SubVI.,E. Using SubVIs,47,Create the icon and connector pane for a VI so you c
21、an use the VI as a subVI. Call the subVI from a test VI.,Exercise 7-1,Temperature Warnings VI As SubVI,48,Exercise 7-1,Do the terminal names in the calling VI need to match the subVI terminal names? Do the data types in the calling VI need to match the subVI terminal data types?,Temperature Warnings
22、 VI As SubVI,49,Activity 7-1,Refer to the participant guide to answer questions about what you have learned in this lesson and then discuss the answers as a group.,50,Lesson Review,On a subVI, which terminal setting causes a broken VI if the terminal is not wired?,Required Recommended Optional,Lesso
23、n Review,51,On a subVI, which terminal setting causes a broken VI if the terminal is not wired?,Required Recommended Optional,Lesson Review,52,You must create a custom icon to use a VI as a subVI.,True False,Lesson Review,53,You must create a custom icon to use a VI as a subVI.,True False You do not
24、 need to create a custom icon to use a VI as a subVI, but it is highly recommended to increase the readability of your code.,Lesson Review,54,How to Use this Slide Deck,Whats Included? Instructional and exercise slides for the LabVIEW Student Ambassadors Whats Excluded? End of lesson quiz questions
25、Exercises that are designated “Homework” exercises Sections involving hardware,Last Updated 10.07.2013,LabVIEW Core 1,57,Course Learning Map,Lesson 7Using Sequential and State Machine Algorithms,Using Sequential Programming Using State Programming State Machines,1,A. Using Sequential Programming,Flo
26、w-Through Parameters Sequence Structures Error Case Structures,2,Using Sequential Programming,Many of the VIs you write accomplish sequential tasks. By default, LabVIEW does not force sequential programming.,Example: Nothing forces the execution order of these tasks. Any one of these tasks could hap
27、pen first.,3,Flow-Through Parameters Force Execution Order,Use error clusters and refnums to force order of execution.,4,Sequence Structures Force Execution Order,Sequence structures are a structure with frames, where each frame executes in order. The second frame cannot begin execution until everyt
28、hing in the first frame completes execution.,5,Avoid Overuse of Sequence Structures,You cannot stop the execution in the middle of a sequence.,6,Better to Use Error Case Structures,The best way to write this VI is to enclose the dialog boxes in Case structures, wiring the error cluster to the case s
29、electors.,7,B. Using State Programming,State Programming State Transition Diagrams,8,State Programming,State programming helps you solve the following issues that sequential programming or flow-through parameters do not: What if you need to change the order of the sequence? What if you need to repea
30、t one item in the sequence more often than other items? What if some items in the sequence execute only when certain conditions are met? What if you need to stop the program immediately, rather than waiting until the end of the sequence?,9,State Transition Diagram,A state transition diagram is a typ
31、e of flowchart that indicates the states of a program and transitions between states.,10,State Transition Diagram,Furnace Example:,11,C. State Machines,Common Uses Infrastructure Transitions,12,State Machines,The state machine design pattern implements a state diagram or flow chart. Common uses of s
32、tate machines: To create user interfaces, where different user actions send the user interface into different states. For process tests, where a state represents each segment of the process.,13,State Machines Infrastructure,A state machine consists of a set of states and a transition function that m
33、aps to the next state. Each state can lead to one or multiple states or end the process flow.,While Loop,Case Structure,Shift Register,Type-Defined Enum,14,State Machines Default Transition,15,State Machines Transition Between Two States,16,State Machines Case Structure Transition,17,State Machines
34、Transition Array Transition,18,Course Project Transition Diagram,19,Course Project,Demonstrate an implementation of a state machine. LabVIEW Core 1Exercise7-1,Exercise 7-1Weather Station Project,Create a Weather Station application using a state machine design pattern. Practice skills learned throug
35、hout this course.,Exercise 7-1Weather Station Project,How would you change the diagram to add an Initialize and Shutdown state?,SummaryQuiz,When using a Sequence structure, you can stop the execution in the middle of a sequence. True False,23,SummaryQuiz Answer,When using a Sequence structure, you c
36、an stop the execution in the middle of a sequence. True FalseYou cannot stop the execution in the middle of a sequence.,24,SummaryQuiz,Which of the following are benefits of using a state machine instead of a sequential structure? You can change the order of the sequence. You can repeat individual i
37、tems in the sequence. You can set conditions to determine when an item in the sequence should execute. You can stop the program at any point in the sequence.,25,SummaryQuiz Answers,Which of the following are benefits of using a state machine instead of a sequential structure? You can change the orde
38、r of the sequence. You can repeat individual items in the sequence. You can set conditions to determine when an item in the sequence should execute. You can stop the program at any point in the sequence.,26,Lesson 8Solving Dataflow Challenges with Variables,Communicating Between Parallel Loops Writi
39、ng to Controls & Reading from Indicators Variables Local Variables Race Conditions,1,A. Communicating Between Parallel Loops,2,Communicating Between Parallel Loops,Dual chart example: Execute multiple tasks at the same time.,3,How do the loops stop in this example?,Passing data among parallel loops
40、is a challenge.,4,How do the loops stop in this example?,You cannot pass data between parallel loops with a wire.,5,B. Writing to Controls & Reading from Indicators,6,Writing to Controls & Reading from Indicators,How would you handle the following dataflow challenges? Initialize front panel controls
41、 with values from a configuration file? Copy a “Ship To” address to a “Bill To” address? Initialize indicators that will be written to later in your code? Write to an indicator in two cases of a Case structure without writing to it in all cases? Sometimes you need to write to a control or read from
42、an indicator.,7,C. Variables,8,Variables,Variables can be of the following types: LocalStores data in front panel controls and indicators. Global Stores data in special repositories that can be accessed from multiple VIs. Functional GlobalStores data in While Loop shift registers. SharedTransfers da
43、ta between various distributed targets connected together over a network.,9,D. Local Variables,When To Use Local Variables Local Variables and Boolean Mechanical Actions How To Create Local Variables,10,Local Variables,Use local variables to pass data within a single VI.,11,Local Variables,Use local
44、 variables to modify front panel control values.,12,Use Switch Mechanical Action,Boolean controls with associated local variables must use switch mechanical action. Boolean latch action is incompatible with local variables.,13,Creating Local Variables,Create and use local variables. LabVIEW Core 1De
45、monstrationsLocal Variables,Exercise 8-1Weather Station UI with Local Variable VI,Use a local variable to write to and read from a control.,Exercise 8-1Weather Station UI with Local Variable VI,What functionality does the local variable provide for this application?,E. Race Conditions,Definition How
46、 To Avoid Race Conditions Controlling Shared Resources,17,Race Conditions,Race conditions are a common problem for programs that execute multiple tasks in parallel and share data between the tasks.,18,What is the final value of the Value variable?,Four possible outcomes: Value = (Value * 5) +2 Value
47、 = (Value + 2) * 5 Value = Value * 5 Value = Value +2,19,Race Conditions,Race conditions are very difficult to identify and debug. Often, code with a race condition can return the same result thousands of times in testing, but still be capable of returning a different result. Avoid race conditions b
48、y: Controlling shared resources. Use one writer, multiple readers. Properly sequencing instructions. Reducing use of variables.,20,Controlling Shared Resources,21,SummaryQuiz,You should use variables in your VI whenever possible. True False,22,SummaryQuiz Answer,You should use variables in your VI w
49、henever possible. True FalseYou should use variables only when necessary. Use wires to transfer data whenever possible.,23,SummaryQuiz,When controlling resources, which combination of writers and readers reduces chance of race conditions? One writer, one reader One writer, multiple readers Multiple
50、writers, one reader Multiple writers, multiple readers,24,SummaryQuiz Answer,When controlling resources, which combination of writers and readers reduces chance of race conditions? One writer, one reader One writer, multiple readers Multiple writers, one reader Multiple writers, multiple readers,25,
51、End of LabVIEW Core 1,Certifications Certified LV Associate Developer Exam,Certified LabVIEW Developer Exam,Certified LabVIEW Architect Exam,LabVIEW Core 3,LabVIEW Core 1 LabVIEW Core 2,Managing SoftwareEngineering in LabVIEW Advanced Architectures in LabVIEW,LabVIEW Connectivity Object-Oriented Des
52、ignand Programming in LabVIEW LabVIEW Performance,LabVIEW Real-Time 1 LabVIEW Real-Time 2,LabVIEW Instrument Control LabVIEW Modular Instruments,LabVIEW FPGA DAQ & Signal Conditioning,Other Courses,New User Experienced User Advanced User,LabVIEW Core 2,What You Need To Get Started,Computer running:
53、LabVIEW 2012 or later Windows XP or later,LabVIEW Core 2 Course Manual LabVIEW Core 2 Exercise Manual LabVIEW Core 2 Course Kit,File Locations,The course installer places the course files in the following location:,Course Goals,This course prepares you to: Use event programming effectively. Apply co
54、mmon design patterns that use queues and events. Programmatically control user interface objects. Evaluate file I/O formats and use them in applications. Modify existing code for improved usability. Prepare, build, and deploy stand-alone applications.,Configuring Your LabVIEW Environment,Change the
55、LabVIEW environment in the Options dialog box. Front Panel page Set Control Style for New VIs to Silver style. Block Diagram page Uncheck Place front panel terminals as icons Enable automatic error handling in new VIs Enable automatic error handling dialogs Configure Block Diagram Cleanup to customi
56、ze your block diagram.,Configuring Your LabVIEW Environment,Functions Palette Tack the Functions palette and select CustomizeChange Visible Palettes then click Select All. Controls Palette Tack the Controls palette and select CustomizeChange Visible Palettes then click Select All.,Course Learning Map,Lesson 1Moving Beyond Dataflow,Asynchronous Communication Queues Event-Driven Programming,A. Asynchronous Com
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电子病历权限管理制度及流程
- 微服务通信协议演进
- 风险控制模型动态调优
- 餐饮行业薪酬结构设计方案
- 制造业质量控制及验收标准
- 物业管理设备维护保养操作手册
- 小学数学-B2微课程设计与制作-微课程方案+教学设计+学生体会
- 高三教学质量综合分析报告书
- B5-技术使用记录
- 人美版一年级上册美术教案
- 金属厂生产制度
- 2026安徽淮北市特种设备监督检验中心招聘专业技术人员4人参考题库及答案1套
- 2025年航空行业空客智能制造报告
- 蒙牛乳业股份有限公司盈利能力分析
- 2025民航西藏空管中心社会招聘14人(第1期)笔试参考题库附带答案详解(3卷合一版)
- (新教材)2026年人教版八年级下册数学 21.2.1 平行四边形及其性质 课件
- 院感新规范解读
- 山东省青岛市2024–2025学年高三生物上学期期末试题【含答案】
- 生产车间清洁度管理制度
- 七年级沪科版数学下册复习 专题01 实数(6重点+17种题型+复习提升)
- 北京版英语1-6年级单词表
评论
0/150
提交评论