Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.

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.
Based on LabVIEW 2011 Student Edition
TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
Room: Rapson Hall 54 Time: 4-5 PM.
Welcome! Workshop 2 of 7.
Developing User Interfaces with Event-driven Programming
Loops in LabVIEW (while,for and case)
De la Rosa-Pohl ECE 1100 Introduction to Engineering Intro to LabVIEW: Programming for Symon University of Houston Diana de la Rosa-Pohl Len Trombetta.
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.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Build.
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.
CS320n –Visual Programming LabVIEW Control Structures.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
Virtual Instrumentation With LabVIEW
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.
Virtual Instrumentation With LabVIEW. Section I LabVIEW terms Components of a LabVIEW application LabVIEW programming tools Creating an application in.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
Chapter 1 LabVIEW Basics. Features > Uses Graphic Symbols > Created by National Instruments > Virtual Instruments (VIs) > Extensive Library of VIs.
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.
1. 2 LabVIEW Intro, Basics, Tips, Tricks Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
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.
Lab 1 : Introduction to LabView 1 Southern Methodist University Bryan Rodriguez.
CS320n –Visual Programming
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.
CS320n –Visual Programming More LabVIEW Foundations.
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.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code that may be executed several times. Fixed-count (definite) loops repeat a fixed.
CS320n – Elements of Visual Programming Assignment Help Session.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
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.
Workshop 2 of 7 Welcome!. Today’s Topics -Review of: -LabVIEW Project -Mechanical Action of Booleans -Custom Controls and Type Definitions.
Week 3 Labview exercises
Welcome! Workshop 3 of 7.
Quiz Which types of folders are available in a LabVIEW Project?
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
EE 200 Design Tools Laboratory 14
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 3 Editing and Debugging VIs
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
Introduction to LabVIEW
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
הודעות ריענון מהיר והרחבות כתיבה לקובץ Low-Level דגימת אות Low-Level
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
LabVIEW 7.1 寒假短期教學課程 歐陽丞修 2006/02/06.
LabVIEW.
Structures- case, sequence, formula node
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.
Presentation transcript:

Workshop 3 of 7 Welcome!

Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure

True or False? 1.Arrays can contain only one data type. 2.An array must contain at least one element. 3.The Bundle function can be used to add elements to a cluster. 4.Clusters can contain both controls and indicators within the same shell; however, arrays cannot. 5.It is possible to have clusters containing arrays as well as arrays containing clusters. 3 Review Question 1

True or False? 1.Arrays can contain only one data type. TRUE 2.An array must contain at least one element. FALSE 3.The Bundle function can be used to add elements to a cluster. FALSE 4.Clusters can contain both controls and indicators within the same shell; however, arrays cannot. FALSE 5.It is possible to have clusters containing arrays as well as arrays containing clusters. TRUE 4 Review Question 1

The Error Cluster contains which of the following? a)Boolean b)Array c)String d)Numeric e)Cluster 5 Review Question 2

The Error Cluster contains which of the following? a)Boolean - status b)Array c)String - source d)Numeric - code e)Cluster 6 Review Question 2

An enumeration is a list of ___ and ___ pairs and acts like a ____ to the computer and ____ to the user. a)integer, string, integer, string b)Boolean, string, boolean, string c)Boolean, integer, boolean, integer d)integer, string, string, integer 7 Review Question 3

An enumeration is a list of ___ and ___ pairs and acts like a ____ to the computer and ____ to the user. a)integer, string, integer, string b)Boolean, string, boolean, string c)Boolean, integer, boolean, integer d)integer, string, string, integer 8 Review Question 3

Review Question 1 If I add a new element to an enum that is saved in a *.ctl file, how would the file need to be saved in order to update all of instances a)Custom control b)Strict Type Definition c)Type Definition

Review Question 1 If I add a new element to an enum that is saved in a *.ctl file, how would the file need to be saved in order to update all of instances a)Custom control b)Strict Type Definition c)Type Definition

Review Question 2 Which of the following always remain unique to each instance? a)Label b)Default value c)Size d)Data type e)Representation (numerics) f)Description

Review Question 2 Which of the following always remain unique to each instance? a)Label b)Default value c)Size d)Data type e)Representation (numerics) f)Description

Review Question 3 True or False? A custom control can only be used for the project within which it was created.

Review Question 3 True or False? A custom control can only be used for the project within which it was created. FALSE

Use loops when you want to repeat a section of code Types: While – repeats until a condition is met For – repeats for X number of iterations 15 Loops

While Loops terminal counts the number of iterations; zero indexed Always runs at least once (therefore, really a do-while loop) Runs until stop condition is met Stop if TRUE Continue if TRUE While Loop Iteration terminal Conditional terminal

For Loops i Terminal counts iterations Runs according to input N of count terminal For Loop i = zero indexed N = one indexed Iteration terminal Count terminal

Creating a Loop 1. Select the structure 2. Enclose code to be repeated 3. Drop or drag additional nodes and then wire

Demonstration: Creating a Loop

 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-indexing Building Arrays with Loops Wire becomes thicker Wire remains the same size Auto-Indexing Disabled Auto-Indexing Enabled Only one value (last iteration) is passed out of the loop 1D Array

If an array is passed into a For Loop and auto-indexing is enabled, the number of elements in the array determines the number of iterations of the For Loop (therefore, you are not required to wire the N terminal) If the iteration count terminal is wired and arrays of different sizes are wired to auto-indexed tunnels, the actual number of iterations is the smallest of the choices. Auto-Indexing Input

Shift Registers - Access Previous Loop Data Come in pairs that are always aligned with each other Available at left and right borders of loop structures To create: Right-click the border and select Add Shift Register Right-click an existing tunnel, select Replace with Shift Register, and click the opposite loop border to create other half of pair Right terminal stores data on completion of current iteration Left terminal provides stored data at beginning of next iteration “Up and around the loop”

Shift Registers in action First Iteration Second Iteration Last Iteration Value 15 Initial Value Before Loop Begins

Stacked Shift Registers Registers remember values from multiple previous iterations and carry those values to the next iterations Values “bump down” with each iteration To create: Right-click » Add Element Expand the left side register (down arrows) up or down by dragging the small square when the mouse is a double arrow Initial Value Note: Still only 1 register on right side

Block Diagram1st run2nd run Initialized Shift Register Output = 5 Not Initialized Shift Register Output = 4Output = 8 VI finishesRun againRun once Shift Registers - Uninitialized

Demonstration: Operation of a Shift Register

Case Structure Have two or more subdiagrams or cases Execute and displays only one case at a time An input value determines which subdiagram to execute Similar to case statements or if...then...else statements in text-based programming languages Case Selector Label Selector Terminal

You can create multiple input tunnels Inputs are available to all cases, but do not have to be used in all cases Case Structure: Inputs

You can create multiple output tunnels You must define each output tunnel for each case, otherwise Wire every case (2) Right-click » Use Default If Unwired (3) Case Structure: Outputs Data TypeDefault Value Numeric0 BooleanFALSE StringEmpty (1) (2)(3)

Case Structure

If the error cluster is wired to the selector, the border of the case structure automatically turns red or green for the error and non-error cases, respectively Case Structure Holy automatic coloring, Batman!

Demonstration: Creating a Case Structure and Adding a Case

Diagram Disable Structure Use to disable a section of code on the block diagram Multiple subdiagrams possible – maximum of one enabled Disabled subdiagrams appear grayed out Great tool for troubleshooting – don’t have to re-write code

Conditional Disable Structure Use to define conditions that indicate which code on the block diagram executes Examples: If running as an executable, then programmatically close LabVIEW when VI finishes If running on Windows, look for file here; if running on Mac OSX then look here.

Events Event — An asynchronous notification that something has occurred Events originate from the user interface, external I/O, or other parts of the program Example events: 35 Button click Value change Mouse over Key press

Event Structure Event Structure — LabVIEW’s programmatic tool for handling events. Therefore, execution of code can be dependent on whether or not an event has occurred 36 Waits for an event to occur indefinitely, unless configured to timeout.

Parts of an Event Structure 37 Timeout Event Selector Label Event Data Node Event Filter Node Event Data Node Identifies the data LabVIEW provides when the event occurs; similar to the Unbundle By Name function Event Filter Node Identifies the subset of data available in the Event Data node that the event case can modify

Notify Events User action has already occurred LabVIEW has processed the event Available only in the Event Data node Filter Events User action has already occurred LabVIEW has NOT processed the event Allows you to override default behavior for event Available in the Event Filter node and Event Data node Notify and Filter Events

Right-click the border and select Edit Events Handled by This Case To Configure an Event Structure…

Events Event Sources Configured Events Configuring Event Structures

Notify Events (green arrow) User action has already occurred Filter Events (red arrow) User performed action but event is not processed. Allows you to customize event handling. Notify and Filter Events in Config. Window

Normally used in a While Loop Control/Indicator the event configured for is often placed inside that event case Event structure handles exactly one event per iteration Sleeps when no events occur Using Event Structures

Event Structures Tips If no timeout is configured and an event never occurs – stuck waiting indefinitely, must abort VI; therefore, wire the timeout terminal with a value other than -1 (at least while developing) “heavy” code within the Event Structure causes the front panel to lock up, often confusing the user – try to keep code in an event case to a minimum

Demonstration: Configuring an Event

Homework 3 is post at ni.com/mst Create a Game Student Zone has a lot of ideas to Homework