CS320n –Visual Programming More LabVIEW Control Structures.

Slides:



Advertisements
Similar presentations
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 5 Selection Statements Animated Version.
Advertisements

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 5 Selection Statements.
A. Virtual Instruments (VIs)
LabVIEW is a graphical programming development environment for data acquisition and control, data analysis, and data presentation. With LabVIEW you can.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Lesson 2 Navigating LabVIEW
Based on LabVIEW 2011 Student Edition
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.
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.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
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.
1 Arithmetic in C. 2 Type Casting: STOPPED You can change the data type of the variable in an expression by: (data_Type) Variable_Name Ex: int a = 15;
CS320n –Visual Programming Introduction to LabVIEW.
CS320n –Visual Programming LabVIEW Control Structures.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
Section 3 - Selection and Repetition Constructs. Control Structures 1. Sequence 2. Selection 3. Repetition.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
V1: HMFR, V2: MFNB, 2007 LabView Seminar University of Puerto Rico Mayagüez Campus.
Virtual Instrumentation With LabVIEW. Section I LabVIEW terms Components of a LabVIEW application LabVIEW programming tools Creating an application in.
Design of Bio-Medical Virtual Instrumentation Tutorial 1.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
LabVIEW an Introduction
Design of Bio-Medical Virtual Instrumentation Tutorial 3.
Branching and Conditions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Part I MVRT 2011 – 2012 Season Introduction to LabVIEW.
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:
CSE 102 Introduction to Computer Engineering What is an Algorithm?
How to start Visual Studio 2008 or 2010 (command-line program)
Multi Way Selection You can choose statement(s) to run from many sets of choices. There are two cases for this: (a)Multi way selection by nested IF structure.
PROBLEM SOLVING & ALGORITHMS CHAPTER 5: CONTROL STRUCTURES - SELECTION.
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
Programming 1 DCT 1033 Control Structures I (Selection) if selection statement If..else double selection statement Switch multiple selection statement.
CS320n –Visual Programming
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
CS320n –Visual Programming More LabVIEW Foundations.
Workshop 2 of 4 Welcome!. Survey While You Wait ni.com/duke >> Recent Documents >> LabVIEW Workshop Participation Survey.
Chapter 3 Decisions Three control structures Algorithms Pseudocode Flowcharts If…then …else Nested if statements Code blocks { } multi statement blocks.
Exercise 1 #include int main() { printf(“Hello C Programming!\n”); return 0; } 1.Run your Visual Studio 2008 or Create a new “project” and add.
Control Flow Statements
Programming Language C++ Lecture 3. Control Structures  C++ provides control structures that serve to specify what has to be done to perform our program.
1 Control Structures (Chapter 3) 3 constructs are essential building blocks for programs Sequences  compound statement Decisions  if, switch, conditional.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
Computer Science Up Down Controls, Decisions and Random Numbers.
Week 3 Data Structures and Common Tools. Common Tools in Labview Automatic Tool Selector Using the Operating Tool Using the Positioning Tool to Select.
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Numbering System TODAY AND TOMORROW 11th Edition
Lecturer CS & IT Department UOS MBDIN
Programming Fundamentals
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.
Chapter 5 Structures.
Doing some Boolean: On/Off
IF if (condition) { Process… }
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
LabVIEW.
Structures- case, sequence, formula node
Program Flow.
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3.
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 8 Other Structures; Local Variables
Presentation transcript:

CS320n –Visual Programming More LabVIEW Control Structures

Visual ProgrammingLabVIEW Control Structures2 What We Will Do Today Learn about other LabVIEW control structures

Visual ProgrammingLabVIEW Control Structures3 Case Structures conditional execution like a if – else in Alice or other languages 2 or more sub diagrams the diagram that executes is based on the input of a selector Selector can be boolean, numeric, or a string

Visual ProgrammingLabVIEW Control Structures4 Case Structure

Visual ProgrammingLabVIEW Control Structures5 Case Structure Current Case Sub Diagram. Can only view one case at a time. Selector input. Will change based on data type of input: boolean, numeric String

Visual ProgrammingLabVIEW Control Structures6 Case Structure Example Create an instrument that can convert degrees F to degrees C or degrees C to degrees F Must choose which conversion to make use a switch on front panel to select which conversion to perform

Visual ProgrammingLabVIEW Control Structures7 Block Diagram Choose sub diagram by clicking on increment / decrement arrows or clicking on the down arrow and selecting from the menu.

Visual ProgrammingLabVIEW Control Structures8 Use Sub VIs Add the C to F and F to C sub VIs to the block diagram

Visual ProgrammingLabVIEW Control Structures9 Partial Block Diagram Problems with tunnels. If data comes out from one case outputs a value, all cases must have an output for that value. Not the same for input

Visual ProgrammingLabVIEW Control Structures10 Completed Block Diagram

Visual ProgrammingLabVIEW Control Structures11 Completed Front Panel

Visual ProgrammingLabVIEW Control Structures12 One More Thing… Any way to make instrument more user friendly than input label of “Temp In” and output label of “Converted Temp”?

Visual ProgrammingLabVIEW Control Structures13 Different Selectors In example selector was boolean –only two cases, true or false selector can be numeric or string control for numeric selector can be any numeric type but will get converted to int for string and numeric selector many possible cases right click on selector to add cases

Visual ProgrammingLabVIEW Control Structures14 Select Function simple alternative to if-else type case structure a boolean input if boolean is true pass on the value wired to t if boolean is false pass on the value wired to f can handle other data types

Visual ProgrammingLabVIEW Control Structures15 Sequence Structure In LabVIEW, execution is driven by data flow when the input data is ready, functions execute sometimes no way of telling which order things will execute in most programming languages, flow of control is not driven by data, but is sequential based on order of statements in program

Visual ProgrammingLabVIEW Control Structures16 Sequence Structure Flat Sequence structure with 2 more frames added. Frames execute in order. Alternative to Flat Sequence Structure is a Stacked Sequence Structure. Visually different in that only one frame visible at a time, but functionally equivalent.

Visual ProgrammingLabVIEW Control Structures17 Class work This exercise makes use of loops, but does not require case structures. Monte Carlo method for determining Pi pi is the ratio of the circumference of a circle to its diameter, no matter which circle you use to compute it.

Visual ProgrammingLabVIEW Control Structures18 Monte Carlo method imagine a quarter of a unit circle. (radius = 1) pick points at random –random value of x and y, between 0 and 1 use distance formula to determine if point is inside or outside circle –square root of (x^2 + y^2) tally up points inside circle pick lot of points estimate of pi = 4 * (points inside / total number of points) 1,1 x y 1,0 0,1. inside. outside

Visual ProgrammingLabVIEW Control Structures19 Class work write a LabVIEW program that picks random points to estimate pi. Allow control for number of random points to pick display resulting estimate of pi