Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1

Slides:



Advertisements
Similar presentations
A. Virtual Instruments (VIs)
Advertisements

Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
LabVIEW is a graphical programming development environment for data acquisition and control, data analysis, and data presentation. With LabVIEW you can.
LabView Academy 5. óra. Témakörök SubVI Modularitás Icon Connector Pane.
Lesson 2 Navigating LabVIEW
Based on LabVIEW 2011 Student Edition
TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
Welcome! Workshop 2 of 7.
Loops in LabVIEW (while,for and case)
Introduction to LabVIEW
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 5 Loops  Read Bishop, Sections 5.1 and 5.2.  Lab #5 and Homework #5 due next week.  Exam #1 next.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Loops A.About While Loops B.About For Loops C.About Case structures D.Sequence Structures E.Formula Node You Will Learn:
1 Lesson 5 Clusters TOPICS Introduction to Clusters Cluster Functions Error Clusters.
Lecture 13LabVIEW and GPIB LabVIEW (National Instruments) –Graphical program language –Widely used in academia (lab) and industry (R&D) General Purpose.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs LabVIEW Programs Are Called Virtual Instruments (VIs) Block Diagram.
LabVIEW an Introduction
Introduction to LabVIEW
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
Design of Bio-Medical Virtual Instrumentation Tutorial 3.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Tlf:
EET 2259 Unit 7 Case Structures; Sequence Structures  Read Bishop, Sections 5.4 and 5.5.  Lab #7 and Homework #7 due next week.  Quiz #3 next week.
Creating, Editing, & Debugging a VI A.How to Create VIs B.How to Edit VIs C.How to Debug VIs You Will Learn:
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
Design of Bio-Medical Virtual Instrumentation Tutorial 2.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs Block Diagram Accompanying “program” for front panel Components.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 9 Arrays  Read Bishop, Sections 6.1 to 6.3.  Homework #9 and Lab #9 due next week.  Quiz #5 next.
Workshop 2 of 4 Welcome!. Survey While You Wait ni.com/duke >> Recent Documents >> LabVIEW Workshop Participation Survey.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
LabVIEW Course Course 2.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Week 3 Data Structures and Common Tools. Common Tools in Labview Automatic Tool Selector Using the Operating Tool Using the Positioning Tool to Select.
Workshop 5 of 7 Welcome!. Today's Topics Review from Workshop 4 Modularity & subVIs Documentation File Input/Output Introduction.
Week 3 Labview exercises
Lesson 7 Using Sequential and State Machine Algorithms
Welcome! Workshop 3 of 7.
Quiz Which types of folders are available in a LabVIEW Project?
LabVIEW Core 1 Key messages for the instructor:
Data Structures Arrays Common Array Functions Polymorphism
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
EE 200 Design Tools Laboratory 14
EET 2259 Unit 11 Charts and Graphs
Topics Introduction to Repetition Structures
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 3 Editing and Debugging VIs
Introduction to LabVIEW
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
Lesson 2: Introduction to Control programming using Labview
הודעות ריענון מהיר והרחבות כתיבה לקובץ Low-Level דגימת אות Low-Level
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Coding Concepts (Basics)
EET 2259 Unit 6 Shift Registers
Introduction to Problem Solving and Control Statements
LabVIEW.
3.1 Iteration Loops For … To … Next 18/01/2019.
Structures- case, sequence, formula node
CST-115 Introduction to Computer Programming
EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3.
Introduction to LabVIEW
LabVIEW基礎課程(一) 參考書籍: LabVIEW for Everyone (Jeffrey Travis/Jim Kring)
EET 2259 Unit 7 Case Structures; Sequence Structures
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 11 Charts and Graphs
EET 2259 Unit 2 Virtual Instruments
EET 2259 Unit 3 Editing and Debugging VIs
Presentation transcript:

Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1 Implementing a VI Lesson 2 Troubleshooting & Debugging VIs Lesson 1 Navigating LabVIEW Lesson 6 Managing File and Hardware Resources Lesson 5 Creating and Leveraging Data Structures Lesson 4 Developing Modular Applications Lesson 8 Solving Dataflow Challenges with Variables Lesson 7 Using Sequential and State Machine Algorithms

Lesson 3 Implementing a VI Front Panel Basics LabVIEW Data Types Documenting Code While Loops For Loops Timing a VI Data Feedback in Loops Plotting Data – Waveform Chart Case Structures

E. For Loops Conditional Terminal Comparison with While Loops Numeric Conversion for Count Terminal

For Loops LabVIEW For Loop Flowchart Pseudo Code N=100; i=0; Until i=N: Repeat (code;i=i+1); End; LabVIEW For Loop Flowchart Pseudo Code

For Loops Create a For Loop the same way you create a While Loop. You can replace a While Loop with a For Loop by right-clicking the border of the While Loop and selecting Replace with For Loop from the shortcut menu. The value in the count terminal (an input terminal) indicates how many times to repeat the subdiagram in the For Loop.

For Loops – Conditional Terminal You can add a conditional terminal to configure a For Loop to stop when a Boolean condition is true or an error occurs.

For Loops – Conditional Terminal For Loops configured with a conditional terminal have: A red glyph next to the count terminal. A conditional terminal in the lower right corner

For Loop/While Loop Comparison Executes a set number of times unless a conditional terminal is added. Can execute zero times. Tunnels automatically output an array of data. While Loop Stops executing only if the value at the conditional terminal meets the condition. Must execute at least once. Tunnels automatically output the last value.

For Loops – Numeric Conversion The number of iterations a For Loop executes must be specified in non-negative integers. If you wire a double-precision, floating-point numeric value to the count terminal, LabVIEW converts the numeric value to a 32-bit signed integer. The For Loop count terminal always coerces to a 32-bit signed integer. Typically, LabVIEW coerces numerics to the format with more bit representation. However, the For Loop count terminal works in the opposite manner. If you wire a double-precision, floating-point numeric value to the 32-bit count terminal, LabVIEW coerces the larger numeric value to a 32-bit signed integer. Although the conversion is contrary to normal conversion standards, it is necessary, because a For Loop can only execute an integer number of times. The For Loop count terminal will always coerce to a 32-bit signed integer data type.

For loop and while loop indexing comparison (NEW SLIDE)

Group Exercise 3-3 Concept: While Loops versus For Loops Understand when to use a While Loop and when to use a For Loop.

F. Timing a VI Reasons To Use Timing Wait Functions and Express VIs

Timing a VI Why do you need timing in a VI? To control the frequency at which a loop executes. To provide the processor with time to complete other tasks, such as processing the user interface.

Wait Functions A wait function inside a loop: Allows the VI to sleep for a set amount of time. Allows the processor to address other tasks during the wait time. Uses the operating system millisecond clock.

Elapsed Time Express VI Determines how much time elapses after some point in your VI. Keeps track of time while the VI continues to execute. Does not provide the processor with time to complete other tasks.

Wait Chart VI Compare and contrast using a Wait function and the Elapsed Time Express VI for software timing. The Wait Chart VI is pre-built for your demonstration in the Exercises\Demonstrations folder.

G. Data Feedback in Loops Shift Registers Initializing Shift Registers Default for Unwired Values Compound Shift Registers

Data Feedback in Loops When programming with loops, you often need to know the values of data from previous iterations of the loop. Shift registers transfer values from one loop iteration to the next. Cover mechanics of using shift registers in later slides; here just talk about why you need them.

Shift Registers Right-click the border and select Add Shift Register from the shortcut menu. Right shift register stores data on completion of an iteration. Left shift register provides stored data at beginning of the next iteration.

Initializing Shift Registers Run once VI finishes Run again Block Diagram 1st run 2nd run Initialized Shift Register Output = 5 Not Initialized Shift Register Output = 4 Output = 8

Use Default if Unwired Default values vary by data type: Uninitialized shift registers use default values for first run. Data Type Default Value Numeric Boolean FALSE String Empty

Multiple Previous Iterations Stacked shift registers remember values from multiple previous iterations and carry those values to the next iterations. Right-click the left shift register and select Add Element from the shortcut menu to stack a shift register.

Exercise 3-4 Average Temperature VI HOMEWORK Use a While Loop and shift registers to average data.

Exercise 3-4 Average Temperature VI You calculated the average of the last 5 temperature readings. How would you modify the VI to calculate the average of the last 10 temperature readings? You calculated the average of the last 5 temperature readings. How would you modify the VI to calculate the average of the last 10 temperature readings? Resize the shift register in the VI to have five additional elements. Resize the Compound Arithmetic function to add 10 values and divide the result by 10.

H. Plotting Data – Waveform Chart

Plotting Data – Waveform Chart Waveform chart is a special type of numeric indicator. Waveform charts display single or multiple plots. Special type of numeric indicator that displays one or more plots of data, typically acquired at a constant rate

Waveform Chart Properties Extensive plot customization lets you: Show or hide legends. Change color and line styles. Change interpolation styles.

Exercise 3-5 Temperature Monitor VI – Plot Multiple Temperatures HOMEWORK Plot multiple data sets on a single waveform chart and customize the chart view.

Exercise 3-5 Temperature Monitor VI – Plot Multiple Temperatures In what ways do the following tools allow the user to interact with the plot? Plot Legend Graph Palette Scale Legend Plot legend: Use the Plot legend to customize how a plot appears in chart. Examples: Line & point style, Interpolation, color, fill Graph Palette: Use the graph palette to interact with the chart as the VI runs. Examples: Panning tool, Zoom Scale Legend: Use the scale legend to label scales and configure scale properties on the chart. Example: Autoscale on/on, set scale format, precision, scale visibility, grid color

I. Case Structures Parts of a Case Structure Enum Case Structures Error Case Structures Input and Output Tunnels

Case Structures Have two or more subdiagrams or cases. Use an input value to determine which case to execute. Execute and display only one case at a time. Are similar to case statements or if...then...else statements in text-based programming languages.

Case Structures Case Selector Label Selector Terminal Contains the name of the current case. Has decrement and increment arrows. Selector Terminal Lets you wire an input value, or selector, to determine which case executes. Case Selector Label Selector Terminal

Case Structures Selector terminal data types: Boolean Error Cluster True case and False Case Error Cluster Error Case and No Error Case Integer, string, or enum Structure can have any number of cases. Include a Default diagram to avoid listing every possible input value. Boolean input to the selector terminal creates two cases: True and False Integer or string input to the selector terminal creates multiple cases. - Developer must add a case for each integer or string as necessary. - If an undefined integer or strings is wired to the terminal, LabVIEW uses the Default case. Enums - Gives users a list of items from which to select a case. - The case selector displays a case for each item in the enumerated type control.

Enum Case Structure Gives users a list of items from which to select The case selector displays a case for each item in the enumerated type control

Shortcut Menu Use the shortcut menu of a Case structure to: Customize the structure and diagrams. Remove or replace the structure. Add, duplicate, remove, or rearrange cases. Specify the Default case. Switch cases.

Error Case Structure Use Case structures inside VIs to execute the code if there is no error and skip the code if there is an error.

Input and Output Tunnels You can create multiple input and output tunnels. Inputs tunnels are available to all cases if needed. You must define each output tunnel for each case. Point out difference between tunnels that have been wired for all cases, tunnels that have not, and tunnels marked as Use Default If Unwired. Point out that the unwired output tunnel will result in a broken Run arrow. The other two options will not cause a broken Run arrow. Zoom in on the tunnels so that students can clearly see the differences. Demonstrate how to enable or disable the Use Default If Unwired option. Tell students to avoid using the Use Default If Unwired option on Case structure tunnels for the following reasons. Adds a level of complexity to the code. Complicates debugging your code.

Case Structures Create case structures using different data type selectors. Add, remove, and duplicate cases. Create different type of output tunnels. Don’t spend much too time on this as students as creating a Case structure is similar to other structures. A pre-built VI with various selector terminal is available in the following demonstration folder: <exercises>\Demonstrations\Case Structures\Case Structures.vi Below are key items to note: Show how the Case structure defaults to a Boolean Case structure with only two cases – True and False. Show how wiring different types of data types to the selector terminal changes the case selector label. Emphasize to students that they should wire the selector terminal BEFORE trying to change the selector terminal. Show the shortcut menu. Add, remove, and duplicate a case. Show how deleting a case is different than removing the Case structure. Show how the Run arrow is broken if a tunnel is not wired in each case.

Exercise 3-6 Temperature Warnings VI HOMEWORK Modify a VI to use Case structures to make a software decision. This is a continuation of an earlier exercise. If students did not complete Exercise 3-1, they should start by modifying the Solution 3-1.

Exercise 3-6 Temperature Warnings VI What happens if all the values are 10? How could you fix this? Are all output tunnels defined? What happens if an output is not defined? What happens if all the values are 10? How could you fix this? You get a freeze warning. There are multiple ways you can fix this. One possibility is to not allow Min Temperature and Max Temperature to be equal by replacing the Greater function with a Greater or Equal function and changing the string constant in the True case to “Upper Limit <= Lower Limit.” Are all output tunnels defined? What happens if an output is not defined? All output tunnels are defined for this exercise. If an output isn’t wired, the Run arrow would be broken. To use the Use Default if Unwired option, one would need to enable it through a shortcut menu selection.

Summary—Quiz If an input to a function is marked with a red dot (known as a coercion dot), what does the dot indicate? Data was transferred into a structure. A For Loop was configured with a conditional terminal. A For Loop iteration terminal is unwired. The value passed into a node was converted to a different representation. Answer is d.

Summary—Quiz Answer If an input to a function is marked with a red dot (known as a coercion dot), what does the dot indicate? Data was transferred into a structure. A For Loop was configured with a conditional terminal. A For Loop iteration terminal is unwired. The value passed into a node was converted to a different representation.

Summary—Quiz Which structure must run at least one time? While Loop For Loop Answer is a.

Summary—Quiz Answer Which structure must run at least one time? While Loop For Loop

Summary—Quiz Control Constant Indicator Connector Pane Which is only available on the block diagram? Control Constant Indicator Connector Pane Answer is b.

Summary—Quiz Answer Control Constant Indicator Connector Pane Which is only available on the block diagram? Control Constant Indicator Connector Pane Answer is b.

Summary—Quiz Switch Until Released Switch When Released Which mechanical action causes a Boolean control in the FALSE state to change to TRUE when you click it and stay TRUE until LabVIEW has read the value? Switch Until Released Switch When Released Latch Until Released Latch When Released Answer is d.

Summary—Quiz Answer Switch Until Released Switch When Released Which mechanical action causes a Boolean control in the FALSE state to change to TRUE when you click it and stay TRUE until LabVIEW has read the value? Switch Until Released Switch When Released Latch Until Released Latch When Released

Lesson # Lesson Title End of Week 3