LabVIEW Basics. Based on LabVIEW 2011 Student Edition

Similar documents
Originally released in 1986, LabVIEW (short for Laboratory Virtual Instrumentation

ECE 463 Lab 1: Introduction to LabVIEW

LabVIEW Case and Loop Structures ABE 4423/6423 Dr. Filip To Ag and Bio Engineering, Mississippi State University

Dept. of Electrical, Computer and Biomedical Engineering. Data Acquisition Systems and the NI LabVIEW environment

NI LabView READ THIS DOCUMENT CAREFULLY AND FOLLOW THE INSTRIUCTIONS IN THE EXERCISES

Virtual Instrumentation With LabVIEW

Introduction to LabVIEW

Engineering Innovation Center LabVIEW Basics

A. Front Panel Design Lesson 4 Implementing a VI

Introduction to LabVIEW Exercise-1

Introduction to LabVIEW. By Finn Haugen, TechTeach

Small rectangles (and sometimes squares like this

Arrays. Collection of data elements that are of same type

Table 1. Inputs and Outputs

LabView instrumentoinnissa, 55492, 3op Labview in instrumentation

Part 1. Creating an Array of Controls or Indicators

Lesson 4 Implementing a VI

CLAD Sample Exam 06. B. Panel Resize. C. Panel Close? D. Value Change

Lecture 3 (week Feb 8-12) Expanding the Features of a VI. Select the Loop Condition. A. Structures--While Loop. A. Structures--For Loop

Virtual Instrumentation With LabVIEW

PHYC 500: Introduction to LabView. Exercise 15 (v 1.2) Producer Consumer Event Structure. M.P. Hasselbeck, University of New Mexico

CLAD Sample Exam 03. C. A control that output a cluster of the controls / indicators on the tabs.

Introduction to National Instruments LabVIEW and Data Acquisition (DAQ)

Lab 1: Getting familiar with LabVIEW: Part I

Certified LabVIEW Associate Developer Examination

Rational Numbers CHAPTER Introduction

Certified LabVIEW Associate Developer Examination

LabVIEW basics. BME MIT János Hainzmann, Károly Molnár, Balázs Scherer, Csaba Tóth

University of Pennsylvania. Department of Electrical and Systems Engineering. ESE Undergraduate Laboratory. Introduction to LabView

Shift Register: Exercise # 1: Shift Register Example VI. 1. Build the following front panel. Figure (8.1): Shift register exercise front panel

PHYC 500: Introduction to LabView. Exercise 8 (v 1.3) M.P. Hasselbeck, University of New Mexico. Arrays, XY Graphs, Disk I/O

LabVIEW: Visual Programming Using a Dataflow Model Extended With Graphical Control Structures. Outline

NAME EET 2259 Lab 3 The Boolean Data Type

PHY Microprocessor Interfacing Techniques LabVIEW Tutorial - Part X File Output and Input

Introduction to LabVIEW

VME Data Acquisition System, ADC Read

Certified LabVIEW Associate Developer Exam. Test Booklet

WELCOME TO LabVIEW 1

Arrays are lists of elements of the same data type. They are analogous to arrays in traditional languages.

Computer Interfacing Using LabView

Labview. Masood Ejaz

II. LAB. * Open the LabVIEW program (Start > All Programs > National Instruments > LabVIEW 2012 > LabVIEW 2012).

INTRODUCTION TO LABVIEW

Basic data types. Building blocks of computation

LabVIEW & FRC. BAA Fall Education Day 2015

Exercise 5: Basic LabVIEW Programming

ENGR 1000, Introduction to Engineering Design

PHYC 500: Introduction to LabView. Exercise 1 (v 1.3) M.P. Hasselbeck, University of New Mexico

CLAD_80.questions.

The LabVIEW Programming Environment and Basic Operations

Advanced Programming Features

Using LabVIEW. with. BiPOM Boards. Quick Start Guide. Document Revision: Date: 18 September, 2009

B. Including the Event Structure within a loop. C. Configuring a Timeout case within the Event Structure

LabVIEW. Table of Contents. Lesson 1. Pre-reqs/Technical Skills Basic computer use

HVRSD Standards-Based Report Card Correlations for Math. Grade 1

Part 1. Summary of For Loops and While Loops

Training material. Introduction to LabVIEW

2. The LabView Environment Two panes will open, one is the Front panel, and one is the Block Diagram

You will have mastered the material in this chapter when you can:

LME Software Block Quick Reference 1. Common Palette

Introduction to LabVIEW. Modified Powerpoint file taken from ma/courses/es110/

Values, Variables, Types & Arithmetic Expressions. Agenda

LabVIEW Express VI Development Toolkit User Guide

Certified LabVIEW Associate Developer Exam. Test Booklet

Faculty of Computing, Engineering and Technology. Real Time Systems 1 CE LabVIEW David D. Hodgkiss & Staffordshire University 1

ME 224: EXPERIMENTAL ENGINEERING. Lecture 2

Syllabus: Mechatronics and Engineering 3

Numbers and Representations

CLAD Sample Exam 04. B. When you create an Array constant on the Block Diagram, it is not visible on the Front Panel.

EEM 232 Digital System I

Represent and solve problems involving addition and subtraction

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Basic Data Acquisition with LabVIEW

Today. 4/5/11 Physics 262 Lecture 10 Questions about Exams Homework. Lab: Continue project. Lecture. Review your exams and review practice exam again.

The completed Labview diagram should now look like the picture below:

Appendix. Numbering Systems. In This Appendix...

Learn LabVIEW 2010 / 2011 Fast

Hands-on Lab 1: LabVIEW NI-DAQ Basics 1

MATH& 146 Lesson 8. Section 1.6 Averages and Variation

Lesson 2 Variables and I/O

Application State Machine

Limitations of Current Implementation of Object Oriented Programming in LabVIEW 8.20 and a Proposal for an Alternative Implementation. v. 1.

Bits, Words, and Integers

Read Temperature Data

Appendix. Numbering Systems. In this Appendix

ECE 202 LAB 1 INTRODUCTION TO LABVIEW

Software and Hardware

Common Core Standards for Mathematics. Grade 1. Operations and Algebraic Thinking Date Taught

ENGR 1000, Introduction to Engineering Design

Page 1 of 6. ME 3200 Mechatronics I Laboratory Lab 2: LabView Computer Systems. Introduction

Module 2, Add on lesson Introduction to the NXT and Mindstorms software. Student. 45 minutes

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Expression and Equations

LabVIEW Academy. 12. óra event, property node

Exercise 0 - Open and Run a Virtual Instrument (Slide 12)

Chapter 1 Histograms, Scatterplots, and Graphs of Functions

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

Computer Arithmetic. In this article we look at the way in which numbers are represented in binary form and manipulated in a computer.

Lecture 2 Tao Wang 1

Transcription:

LabVIEW Basics Based on LabVIEW 2011 Student Edition Virtual instruments LabVIEW works on a data flow model in which information within a LabVIEW program, called a virtual instrument (VI), flows from data sources to data sinks connected by wires. The data can be modified as it is passed from source to sink by other VIs. LabVIEW supports two types of VIs--internal VIs and user created VIs. Internal VIs are packaged with LabVIEW and perform simple functions like adding numbers or opening files. User created VIs consist of both a graphical user interface called the front panel and a code pipeline called the block diagram. These VIs tend to be much more complex considering that they can contain any number of internal or user created VIs in an endless number of configurations. 1

Virtual instruments - cont. Consider a simplistic LabVIEW program which takes a single number from the user and multiplies it by 10. Analyzing such a program reveals the following data flow structure: 1. The user inputs a number (data source). 2. The program executes an addition VI taking the user's number and the number 10 as its inputs (data sink). 3. The addition VI returns the result of the addition operation (data source). 4. The result is displayed on the screen (data sink). While this example is simplistic, it exemplifies how all LabVIEW VIs work. Data always flows from data sources to data sinks according to the block diagram, much like how water flows through a pipe. Front Panel Every user created VI has a front panel that contains the graphical interface with which a user interacts. The front panel can house various graphical objects ranging from simple buttons to complex graphs. Various options are available for changing the look and feel of the objects on the front panel to match the needs of any application. 2

Block diagram Nearly every VI has a block diagram containing some kind of program logic that serves to modify data as it flows from sources to sinks. The block diagram houses a pipeline structure of sources, sinks, VIs, and structures wired together in order to define this program logic. Most importantly, every data source and sink from the front panel has its analog source and sink on the block diagram. This representation allows the input values from the user to be accessed from the block diagram. Likewise, new output values can be shown on the front panel by code executed in the block diagram. Controls The most common form of a data source in LabVIEW is a control. This element appears as some type of graphical element on the front panel of a VI that can receive input from a user or even another VI. As stated previously, any data source also has an analog symbol that appears on the block diagram so that its value can be read and used in the code pipeline. Controls make no exception to this rule. Every control has an associated data type that determines what kind of data flows from it on the block diagram. Every data type also has an associated color shown on the block diagram. Typical controls and their associated data types. In general, any control can be turned into an indicator and viceversa. 3

Data types Different data types are indicated with different colors. Floating point numbers (decimal numbers) are shown in orange color. The letters DBL on the icon is for double, which refers to floating point numbers with double precision, which expresses the numerical accuracy of the internal representation of the number in the computer. You can think of floating point numbers as decimal numbers. Integers are shown in blue color. One example is a numeric constant. Boolean data are shown in green color. The letters TF on the icon is for True/False, which are the two possible boolean (logical) values of the element. One example is the Stop terminal. Textual data are shown in pink color. Cluster data are shown in brown color. Clusters are multivariables. They contain one or more elements of possibly different data types. Indicators The most common form of a data sink in LabVIEW is an indicator. This element appears as some type of graphical element on the front panel of a VI that can display output to a user or even another VI. As stated previously, any data sink in LabVIEW also has an analog symbol that appears on the block diagram so that its value can be updated in the code pipeline. Indicators make no exception to this rule. Every indicator also has an associated data type that determines what kind of data can be written to it on the block diagram. The front panel and block diagram for the simple number plus ten example. It should be noted that the number control and answer indicator have their similarly named analogs on the block diagram. Typical indicators and their associated data types. In general, any control can be turned into an indicator and vice-versa. 4

Palettes Front panel controls and indicators as well as block diagram VIs are available from a palettes visible depending on what window is currently active in the LabVIEW environment. These palettes have their contents separated into sub-categories containing controls, indicators, and VIs. Typical top-level block diagram and front panel palettes. Structures In addition to controls, indicators, and VIs, the block diagram can also contain a number of programming structures that modify the sequence of data flow on the block diagram. These structures perform traditional functions like looping or case-selection, but many also provide services that have no clear counterparts in text based programming languages. LabVIEW currently supports six different structures -- while-loops, case structures, event structures, for-loops, sequence structures, and formula nodes. 5

While-loops One of the most common structures encountered on a block diagram is the while-loop. Much like in text-based languages, the LabVIEW while-loop continually executes until a given boolean condition is met. Unlike in text-based languages, the LabVIEW while-loop contains its own loop counter that provides the current loop iteration starting at zero. Three different ways of using a while-loop. The first loop continues forever because the loop conditional never becomes false. The second loop continues until a button on the front panel is pressed, sending a value of true to the loop conditional thereby stopping the loop. The third loop also continues forever, but also displays the current loop counter value in an indicator on the front panel. (It is important to note that these three loops will execute in parallel because their inputs are not dependent on each other.) While-loops - cont The while-loop is typically used in LabVIEW to continue some operation until either the user or some code event indicates that the operation should stop. Normally, some kind of millisecond delay is also inserted into the loop so that it doesn't occupy all of the computer's CPU time. A while-loop that will stop when the loop iterator passes 1000 or when the user presses the stop button. A loop delay is also used to ensure that the loop operation doesn't occupy all of the CPU time. 6

While-loops - cont Nearly all structures in LabVIEW, including while-loops, can have inputs and outputs. Wires that pass into and out of while-loops form small connection points called tunnels on the structure. Various, powerful options are available for shaping data flowing through tunnels, ie. shift registers. Input and output loop tunnels. The while loops takes a numeric value through an input tunnel and multiplies it times its current iteration value. When the loop is stopped, the value of the last multiplication is passed through an output tunnel and displayed in another indicator. Case structures Another common structure encountered in LabVIEW is the case structure. Like in text-based languages, the case structure executes a block of code based on the value of a certain variable. In LabVIEW, a case selector located on the case structure is wired to a data source. The value fed into the case selector determines what case executes. Only one case is shown at a time, but the visible case can be cycled by clicking on the arrows to the left or the right of the case name. The use of a case structure as a simple boolean if-statement. If the two numbers entered by the user add to zero, then a string message is displayed on the front panel saying so. If the two numbers do not add to zero, then a string message is displayed stating that they do not. The false case of the case structure is not shown. 7

For-loops Another common looping structure encountered on a block diagram is the for-loop. Much like in text-based languages, the LabVIEW for-loop continually executes until a given count is reached. Unlike in text-based languages, the LabVIEW for-loop can only step towards the final count by increasing the loop counter by one each iteration. To make larger steps or to step in the negative direction, while-loops with shift registers must be used. For-loop counter. The loop runs from zero to ninety-nine and increases the loop counter by one each iteration. Formula Nodes A Formula Node is a box where you enter algebraic formulas directly into the Block Diagram. It is useful when an equation is complicated or has many variables. Below is an example of how you would implement y = x^2 + x + 1 with regular block diagram nodes: It is much easier to use the Formula Node. Below is an example: 8

Clusters Cluster data types are somewhat unique to LabVIEW and act as containers capable of storing a number of variables of different data types. In the simplest sense, clusters can be thought of as a group of data values that are bundled together to form a more complex, and often more meaningful, data type. From an object oriented perspective, clusters can be thought of as primitive objects with a number of properties without any methods to acts on them. A cluster with a number of elements. This cluster can be thought of representing a set of properties of a college course that can flow as a single object through the wires on the block diagram. Clusters - cont A number of operations exist for clusters, the most important of which are the bundling and unbundling operations. Individual pieces of data flowing through different wires can be bundled together to form a cluster that flows through a single wire. Likewise, a cluster flowing through a single wire can be unbundled so that its elements can flow through their own wires. Cluster bundling and unbundling. The person cluster is unbundled to reveal its elements so that the age element can be increased by one. The data is then bundled again to create a new cluster with the updated values. Notice that the cluster elements are given by name here. 9

Clusters - cont Clustering is commonly used for two purposes. First, clusters help to logically group related data values together, thus supporting the object oriented idea of encapsulation. Second, clusters help to minimize the number of wires on the block diagram that flow into VIs. If clusters did not exist, VIs with cluster inputs would have to receive all of their data through separate wires leading to drastic decreases in readability. 10