Lab 4 : Execution Structures in NI LabVIEW

Similar documents
EET 310 Programming Tools

LabVIEW Day 1 Basics. Vern Lindberg. 1 The Look of LabVIEW

Exercise 10: Basic LabVIEW Programming

Introduction to LabVIEW

Lab 4 - Data Acquisition

Lab 3: Introduction to Data Acquisition Cards

Hands-On: Introduction to Object-Oriented Programming in LabVIEW

LabVIEW Lesson 5 Clusters

User Guide to LabVIEW & APT

LabVIEW DSP Test Integration Toolkit for TI DSP

Introduction to LabVIEW for Control Design & Simulation Ricardo Dunia (NI), Eric Dean (NI), and Dr. Thomas Edgar (UT)

Getting Started with the LabVIEW Mobile Module Version 2009

Sample. LabVIEW TM Core 1 Course Manual. Course Software Version 2010 August 2010 Edition Part Number B-01

Annex: VISIR Remote Laboratory

Getting Started with the LabVIEW Mobile Module

MICROSOFT OUTLOOK 2010 WORK WITH CONTACTS

First Bytes Programming Lab 2

DSP Laboratory: Analog to Digital and Digital to Analog Conversion

Jump-Start Tutorial For ProcessModel

Data Acquisition Using NI-DAQmx

Migrating Groupwise Data

LabVIEW Tutorial Manual

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

School of Electrical and Information Engineering. The Remote Laboratory System. Electrical and Information Engineering Project 2006.

LabVIEW Report Generation Toolkit for Microsoft Office User Guide

Lab 11 Digital Dice. Figure Digital Dice Circuit on NI ELVIS II Workstation

CORSAIR GAMING KEYBOARD SOFTWARE USER MANUAL

X-Trade Brokers Dom Maklerski S.A. XTB Expert Builder. Tutorial. Michał Zabielski

LabVIEW Report Generation Toolkit for Microsoft Office

Making Visio Diagrams Come Alive with Data

Cell Phone Vibration Experiment

Hands-onIntroduction todataacquisition

Statgraphics Getting started

LabVIEW Day 6: Saving Files and Making Sub vis

Lab 1: Introduction to PSpice

Visual Logic Instructions and Assignments

LABVIEW DSP TEST TOOLKIT FOR TI DSP

Getting Started with the LabVIEW Embedded Module for ARM Microcontrollers 1.0 For the Keil MCB2300

1. Installing The Monitoring Software

Data Visualization. Brief Overview of ArcMap

Introduction to Simulink

Lab View with crio Tutorial. Control System Design Feb. 14, 2006

Introduction to LogixPro - Lab

Creating Database Tables in Microsoft SQL Server

Introduction to MS WINDOWS XP

HP LASER GAMING MOUSE USER MANUAL

How To Run A Factory I/O On A Microsoft Gpu 2.5 (Sdk) On A Computer Or Microsoft Powerbook 2.3 (Powerpoint) On An Android Computer Or Macbook 2 (Powerstation) On

Windows 8.1 Tips and Tricks

How to connect your Victron to a computer with VE Bus Quick Configure

6. If you want to enter specific formats, click the Format Tab to auto format the information that is entered into the field.

IBM Business Process Manager Version 8 Release 5. Hiring Tutorial IBM

The Helios Microsoft Windows Server

HOW TO ORGANIZE PICTURES

Auto Clicker Tutorial

Data Visualization. Prepared by Francisco Olivera, Ph.D., Srikanth Koka Department of Civil Engineering Texas A&M University February 2004

Blue Squirrel's PopUp Stopper

Acrobat PDF Forms - Part 2

Introduction To Microsoft Office PowerPoint Bob Booth July 2008 AP-PPT5

EXPERIMENT NUMBER 5 BASIC OSCILLOSCOPE OPERATIONS

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

Bio-interactive FLASH games. Instruction Manual

2.6. In-Laboratory Session QICii Modelling Module. Modelling Module Description

Creating tables of contents and figures in Word 2013

Manual. OIRE Escuela de Profesiones de la Salud. Power Point 2007

Microsoft Excel Tutorial

Avery Dennison UK Consumer Helpline: Consumer

AB-Clock. Manual. Copyright by GRAHL software design

Advanced Word for Windows

Microsoft Windows Overview Desktop Parts

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

Using Microsoft Word. Working With Objects

Intro to Excel spreadsheets

Access Tutorial 2: Tables

Lab 1: Full Adder 0.0

Adobe InDesign Creative Cloud

PowerWorld Simulator

LabVIEWTM. Getting Started with LabVIEW. Getting Started with LabVIEW. June J-01

Petrel TIPS&TRICKS from SCM

AODA Mouse Pointer Visibility

Triggers & Actions 10

Access Tutorial 6: Form Fundamentals

Linkage 3.2. User s Guide

Excel 2007 Basic knowledge

INTRODUCTION TO COMPUTER CONCEPTS CSIT 100 LAB: MICROSOFT POWERPOINT

Introduction to Visio 2003 By Kristin Davis Information Technology Lab School of Information The University of Texas at Austin Summer 2005

CREATE A 3D MOVIE IN DIRECTOR

Inking in MS Office 2013

How to set up a database in Microsoft Access

TECHNICAL TRAINING LAB INSTRUCTIONS

National RTAP Marketing Transit Toolkit Customizing Templates in Microsoft Publisher

5. Tutorial. Starting FlashCut CNC

0 Introduction to Data Analysis Using an Excel Spreadsheet

MS Access Lab 2. Topic: Tables

I ntroduction. Accessing Microsoft PowerPoint. Anatomy of a PowerPoint Window

Installing Remote Desktop Connection

2. Select Point B and rotate it by 15 degrees. A new Point B' appears. 3. Drag each of the three points in turn.

Getting Started Manual

Project 1 - Business Proposal (PowerPoint)

Drip Marketing Campaign Manual

Tips Tricks and Techniques for Efficient LabVIEW Development

Transcription:

Lab 4 : Execution Structures in NI LabVIEW Execution structures contain sections of graphical code and control how and when the code inside is run. The most common execution structures are While Loops, For Loops and Case Structures which you can use to run the same section of code multiple times or to execute a different section of code based on some condition. The while loop The While Loop is located on the Structures palette. Select the While Loop from the palette then use the cursor to drag a selection rectangle around the section of the block diagram you want to repeat. When you release the mouse button, a While Loop boundary encloses the section you selected. Add block diagram objects to the While Loop by dragging and dropping them inside the While Loop. The While Loop executes the code it contains until the conditional terminal, an input terminal, receives a specific Boolean value. The iteration terminal is an output terminal that contains the number of completed iterations. The iteration count for the While Loop always starts at zero. Note: The While Loop always executes at least once. Graphical code The loop iteration count from 0 to inf. Or until a true value reaches the loop enable which will make the loop iteration to reset Loop enable Rest the loop when it receives a true value

Example (1):- Create a system with three leds with the following specification: The first led lights when the iteration is less than 10 The second led lights when the iteration is more than 10 and less than 20 The third led lights when the iteration is more than 20 The system should reset ( iteration=0) when the iteration reaches 30 Solution :- 1- First create the front panel design which consist of three leds as shown in figure 1 Figure 1 front panel of the system 2- The main idea depends on the iteration value so we need to use the comparison function ( ) in order to meet the system specification, for example the first led should light when the iteration is less than or equals to 10 so we use the function as for the second led it should light when two conditions are true so we use comparison function in addition to an AND gate and final the same for the third led 3- To reset the system at 30 we use the equal function as shown in figure 2 مهم 4- When a loop finishes executing an iteration, it immediately begins executing the next iteration, unless it reaches a stop condition. Most often, you need to control the iteration frequency or timing. For example, if you are acquiring data, and you want to acquire the data once every 10 seconds, you need a way to time the loop iterations so they occur once every 10 seconds. Even if you do not need the

execution to occur at a certain frequency, you need to provide the processor with time to complete other tasks, such as responding to the user interface. An indicator to see the value of the iteration Loop delay This icon is used for slowing the loop down in order for a human to see the leds go on and off in other word the iteration is increased every 1000ms Figure 2 block diagram of the system Report exercise 1- Control the loop delay in the last example so the led can go faster or slower? The For loop The for is used to perform a task according to a number defined by the user. The For Loop differs from the While Loop in that the For Loop executes a set number of times. A While Loop stops executing only if the value at the conditional terminal exists. The for loop has two terminals as in figure 3: 1- The count terminal is an input terminal whose value indicates how many times to repeat the subdiagram 2- The iteration terminal is an output terminal that contains the number of completed iterations. Figure 3 for loop

The for loop iteration always starts from zero. Example (2):- Use the for loop structure to make a flashing wave of five leds and control the flashing speed. Solution:- 1- Design the front panel with five leds and a Knob which is used to control the speed as shown in figure 4 Figure 4 front panel of the system 2- Since we have five led flasher we need the loop to run five time so we put the counter terminal to 5,see figure 5 Figure 5 block diagram panel of the system

Report exercise 2 Use the for loop structure to make a flasher of one led with following specification: The user should control the flashing speed Hint (the main idea is to divide the iteration by 2 and see if the result القسمة) (باقي equal zero or not, you can find the Modulo operator on mathematics ) The Case structure:- A Case structure has two or more subdiagrams, or cases. Only one subdiagram is visible at a time, and the structure executes only one case at a time. An input value determines which subdiagram executes. The Case structure is similar to switch statements or if...then...else statements in text-based programming languages see figure 6. Figure 6 Case structure The case selector label at the top of the Case structure contains the name of the selector value that corresponds to the case in the center and decrement and increment arrows on each side. Click the decrement and increment arrows to scroll through the available cases. You also can click the down arrow next to the case name and select a case from the pulldown menu. Wire an input value, or selector, to the selector terminal to determine which case executes. You must wire an integer, Boolean value, string, or enumerated type value to the selector terminal. You can position the selector terminal anywhere on the left border of the Case structure. If the data type of the selector terminal is Boolean, the structure has

a True case and a False case. If the selector terminal is an integer, string, or enumerated type value, the structure can have any number of cases. Right-click the Case structure border to add, duplicate, remove, or rearrange cases, and to select a default case. Example (3):- Design a labview program to calculate the area of a circle, and rectangle using case structure. Solution:- 1- Design the front panel as shown is figure 7. Figure 7 front panel of the system 2- Connect the block diagram as following Figure 8 block diagram of the system

Example (3):- Built a function generator that generates sin, square, and triangular waves. The user should control the amplitude, frequency, and phase (delay) using case structure. Solution:- The system has three cases ( sin, square, triangular ) so we need a case structure with three case Sine we need to control the amplitude, frequency and delay we need three Knobs. We need a graph screen to see the output. In this example we will use a new item which is the ring menu as the selection for the case structure, figure 9 shows the block diagram screen. Figure 9 front panel of the system The ring menu work as a selection for the case structure, so we need three case and to do than we right click on the menu and choose Edit Items, each item has a value and you enter the name of this item as shown in figure 10

To enter a new item To delete an existing item Figure 10 Edit Items option in ring menu In order to generate a signal in labview we use the simulate signal icon as shown in figure 11 Figure 11 simulate signal

Double click on the simulate signal to choose the output signal as shown in figure 12 Figure 12 simulate signal configuration Now in each case in the case structure put a simulate signal each one produce a different signal and connect the three knob to the simulate signal for example connect the amplitude knob to the amplitude in each simulate signal as shown in figure 13

Report exercise (3):- Create a simple Case Structure Application to convert degree from Celsius to Fahrenheit and opposite VI. There is a Boolean control applied to the selector terminal, so the Case Structure is the Boolean data type. When he Boolean control on the Front Panel is in the up position, it returns a FALSE to the selector terminals which invoke the Celsius to Fahrenheit case. Bonus report exercise (no mark lose if not solved) Use the loop structures to make a flashing wave of five leds with following specifications:- The user should control the flashing speed The system contains a button to change the flashing direction (bio directional flasher) Hint (you may use a for loop and a case structure)