Loops in LabVIEW (while,for and case)

Slides:



Advertisements
Similar presentations
LabVIEW for Physicists 24 th October 2002 Ben Jeffery.
Advertisements

A. Virtual Instruments (VIs)
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.
Based on LabVIEW 2011 Student Edition
TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
TP4: S TATE M ACHINE D ESIGN P ATTERN  Definition  Infrastructure  Transition Code  Conclusion.
Intermediate Code Generation
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
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.
True or false A variable of type char can hold the value 301. ( F )
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:
Loops – While, Do, For Repetition Statements Introduction to Arrays
CS320n –Visual Programming LabVIEW Control Structures.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
CONTROL STATEMENTS Lakhbir Singh(Lect.IT) S.R.S.G.P.C.G. Ludhiana.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
Fundamentals of Python: From First Programs Through Data Structures
Lecture 13LabVIEW and GPIB LabVIEW (National Instruments) –Graphical program language –Widely used in academia (lab) and industry (R&D) General Purpose.
How to use LabVIEW Ihor Korolov February 2011.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
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.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Tlf:
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Lecture 4 C Program Control Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
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.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Summer Computing Workshop. Introduction  Boolean Expressions – In programming, a Boolean expression is an expression that is either true or false. In.
‘Tirgul’ # 3 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #3.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
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.
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
LabVIEW Course Course 2.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
C Program Control September 15, OBJECTIVES The essentials of counter-controlled repetition. To use the for and do...while repetition statements.
EE 200 Design Tools Laboratory 14
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
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.
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Structured Program
Coding Concepts (Basics)
Introduction to Problem Solving and Control Statements
LabVIEW.
Statement-Level Control Structures
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.
Presentation transcript:

Loops in LabVIEW (while,for and case) Prepared by: JENNI Amal LASSOUED Hèla IIA4/G2

PLAN 1)Introduction 2)subject 3) About structure 4)Applications 5)quiz

Introduction LabVIEW: Is a graphical programming language using the notion of data flow Integrates the acquisition, analysis, processing and presentation of data. Is a tool for designing and implementing used to foster the intuitive approach of the programmer or user Is based on familiar tools ,easy to use for programming like program structure, arithmetic functions…

what is a structure? Why we used? introduction what is a structure? Why we used? Structures: are graphical representations of loops and condition statements in textual programming languages​​. are used in the diagram to repeat blocks of code and to execute code conditionally or in a specific order. They control the flow of data in a VI These structures has many types like : Sequence Structure ,structure of repetition ,control of choice..

Presentation of the subject While loop For loop Case loop

subject How to create For , While and Case loops? what is the difference between loops? when the appropriate time would be to use them in your program? Which are the other concept related to these loops? What can we do with loops?

How to create For , While , and Case loops? Select your loop 2. Framing the code that must be repeated. 3. Place additional nodes (Boolean control: stop button for example) and connect them.

While loop: what is the difference between loops? Similar to a do loop or repeat until loop in text-based programming . is a control flow statement you use to execute a block of the subdiagram code repeatedly until a given Boolean condition is met.

While loop: what is the difference between loops? Contains: The conditional terminal, defines when the loop stops. There are two settings for the conditional terminal: Continue if True :the while loop runs only if a Boolean value of true is Sent to the terminal Stop if True: the loop halts execution, when a Boolean value of true is sent to the conditional terminal The stop button can be enabled,disabled or disabled & grayed we can also choose the button behavior default will be the end condition "stop if true“. You can switch the conditional terminal to Continue if true, just a right-click on the conditional terminal.

what is the difference between loops? The iteration terminal is an output terminal that contains the number of completed iterations. The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0. it runs at least one faith as the continuation test is done at the end It is better to relate the conditional terminal to one condition to stop because it can lead to an infinite loop.

For loop: executes a subdiagram a set number of times what is the difference between loops? For loop: executes a subdiagram a set number of times contains a count terminal. The count terminal dictates how many times the subdiagram is executed. The iteration count, always starts at zero. During the first iteration, the iteration terminal returns 0. It is possible to place a while loop and then changed to a for loop and screw it to.

what is the difference between loops? the terminal count must be an integer ,if for example it assigns a float, labview retrieve only the integer part. if N = 0 or a negative value ,the loop will not run you can choose the value of N: in an explicit way: you connect a value outside the loop on the entered N in an implicit way :by a self-indexing: For each loop for ,the output value will be stored in a table and added to the given lap before: we can added a conditional terminal us a result the execution of the action would be controlled not only by the count terminal but also by the conditional terminal .

Case loop: what is the difference between loops? The structure condition contains at least two sub-diagrams. The structure will execute a single sub-diagram according to the criterion of selection .. The selection criterion can be either a boolean, an integer or a string. case selector label:contains the name of the selector value Selector terminal:It determinate which case executes. if we enter a selector value that does not match the type of object associated with selector terminal : the value appears red to indicate that we must delete or edit the value Must specify a default case to handle cases that do not belong to our selection(click right button)

what is the difference between loops? Case loop can not use a point number floating To The case . otherwise labVIEW rounded value to the nearest integer value. if at least one case is not bound to a tunnel, labview does not know what to put in the tunnel the center of the tunnel will be white There are for types of case structure: 1) Integer Case Structure 2)Boolean Case Structure 3)String Case Structure 4)Enumerated Case Structure

when we must use each type of loop? 1-While loop: When one does not know in advance the number of iteration to execute It is necessary to change the condition inside the loop, to avoid an infinite loop which is true all the time.. is changed dynamically allocating memory 1-For loop: We used for loops, where it is known from the begening how much a program must be run. the compiler can properly allocated and knows the correct memory size there is no need to calculate termination condition at each iteration both of the two loops preserve information through multiple iterations with shift register,or feedback nodes. Case loop: when the program has performed different actions, depending on the value of the selection criterion.

Which are the other concept related to these loops? Tunnels: it allows the passage of data to and from the structure it appears as a solid block on the Border of the loop and has a color that matches the type of data the data passed to the outside if the execution of the loop terminates even if the data come from outside the loop runs only if all data are available There is two types of tunnel: In for loop ,auto- indexing is anabled by default In while loop ,auto_indexing is disabled by default Auto-indexed tunnel disabled Auto-indexed tunnel enabled

Witch are the other concept related to these loops? Shift registre: usually when programming with loops we need data from Previous iterations. it appears as a pair of opposite terminal It takes data from the right side and left side refer to the next iteration

Haw to Create: Right click on one edge of the loop>> "Add a shift register" We can use several shifts register. Register transmit all data’s type and automatically changed to the same type of the first object wired to the tunnel. The initialization of the shift register is important to avoid Error!

Stacked shift registrer: it lets out a values ​​from several previous iterations to use in the next iteration it must be in the left side because in the right it only allows to transfer data from the current iteration to next . Feedback Node: It’s used to store data from a previous VI or loop execution. Because a Feedback Node stores only one data value at a time, the node is useful in storing and retrieving state information from the previous execution. it should be initilized to avoid erreur

Creating table using loops: Can we use loops to create others structure? Creating table using loops: if we use a while loop we right click on the tunnel resulting and we select "enable indexing.” if you use a for loop indexing is enabled by default. the tunnel output is an array of all values ​​of the VI or function returns after each iteration of the loop. If we disable the auto-indexing on an output tunnel, only the element of the last iteration of the loop passes to the next node in the diagram The most efficient method for creating an array is: Using a For loop with Auto-indexing

Paralell loops: can handle multiple tasks simultaneously and independently passing data between multiple loop without creating a data dependency pay attention to problems of coordination and communication between loops to avoid data dependency we must not use ware to pass data between loops running in parallel the wire creates a dependency of information because it imposes on the second loop do begin to run only if the first finished and passes information

State machine: state machine can easily change the order of execution states and makes decisions at each new state. It consists of a while loop that toggles from one state to another, a shift register to another .. Plotting data: thanks to the loops we can draw curves as they provide a multitude of points Master slave: It is used when you have two or more processes that need to run simultaneously and continuously but at different rates. The Master/Slave pattern consists of multiple parallel loops The master loop controls all of the slave loops, and communicates with them using messaging architectures.

Application:

Application 2:

Quiz: 1) For a for loop, if N = 7 what are the possible values ​​at the node iteration i? 2)Under which of the following conditions does a For loop stop executing? a. When a false value is present at the conditional terminal and the conditional terminal is b. When the value of the iteration terminal , is one less than the value of the count terminal, c. When the value of the iteration terminal, , is one more than the value of the count terminal, d. None of the above

3) Elements "exit 1" and "exit 2 " indicate they have the same value during program execution. 4)What are the values ​​of "a ", "b", "c " and "Boolean" at the end of the code enforcement

Thanks for your attention