GET130 Intro to Engineering Technology

Similar documents
Part 1. Creating an Array of Controls or Indicators

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

Introduction to LabVIEW

Lesson 4 Implementing a VI

Introduction to LabVIEW Exercise-1

Part 1. Summary of For Loops and While Loops

LabVIEW Express VI Development Toolkit User Guide

Read Temperature Data

Lab 1: Getting familiar with LabVIEW: Part I

Small rectangles (and sometimes squares like this

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

Table 1. Inputs and Outputs

Arrays. Collection of data elements that are of same type

Getting Started with LabVIEW Virtual Instruments

SUM - This says to add together cells F28 through F35. Notice that it will show your result is

Experiment 1: Introduction to Labview 8.0 (tbc 1/7/2007, 1/13/2009,1/13/2011)

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

Virtual Instrumentation With LabVIEW

Lesson 1 Introduction to LabVIEW. TOPICS LabVIEW Environment Front Panel Block Diagram Dataflow Programming LabVIEW Help and Manuals Debugging a VI

Determination of Drag Coefficient

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

A. Front Panel Design Lesson 4 Implementing a VI

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

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

ECE 463 Lab 1: Introduction to LabVIEW

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

Certified LabVIEW Associate Developer Exam. Test Booklet

Virtual Instrumentation With LabVIEW

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

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

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

Certified LabVIEW Associate Developer Exam. Test Booklet

Labview. Masood Ejaz

LabVIEW Experiment 1 Light Sensor Calibration Using Arduino Data Acquisition (Arduino DAQ)

Step-by-Step Data Acquisition Part II Exercise 2: Generating an Analog Output Waveform

Certified LabVIEW Associate Developer Examination

BE/EE189 Design and Construction of Biodevices Lecture 4. BE/EE189 Design and Construction of Biodevices - Caltech

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

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

Certified LabVIEW Associate Developer Examination

INTRODUCTION TO LABVIEW

Introduction to LabVIEW. By Finn Haugen, TechTeach

NAME EET 2259 Lab 3 The Boolean Data Type

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

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

Learn the three palettes. Learn how data is passed in LabVIEW. Create a subvi using two different methods.

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

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

Numbers Basics Website:

OpenStax-CNX module: m Thermometer VI * National Instruments

Using Flash Animation Basics

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

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

PHYS 5061 Lab 1: Introduction to LabVIEW

ni.com Preparing for the CLAD Exam

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

Exercise 5: Basic LabVIEW Programming

DSP First Lab 02: Introduction to Complex Exponentials

Computer Interfacing Using LabView

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Spectroscopic Analysis: Peak Detector

Basic Data Acquisition with LabVIEW

Chapter 1: Introduction to the Microsoft Excel Spreadsheet

Lab 4 - Data Acquisition

Strain and Force Measurement

Learn LabVIEW 2010 / 2011 Fast

LABVIEW HANDOUT 3 CHAPTER 3: THE MATHSCRIPT NODE AND XY GRAPH

Homework Assignment 9 LabVIEW tutorial

addition + =5+C2 adds 5 to the value in cell C2 multiplication * =F6*0.12 multiplies the value in cell F6 by 0.12

LabView instrumentoinnissa, 55492, 3op Labview in instrumentation

FRC LabVIEW Sub vi Example

Engineering Project-I. Module 1: Familiarization of LabVIEW and the Vernier Toolkit

Exploring IX1D The Terrain Conductivity/Resistivity Modeling Software

LabView programming 練習

[ mini-project ] Create standard MIDI files with LabVIEW *

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

Introduction to National Instruments LabVIEW and Data Acquisition (DAQ)

Introduction to Excel 2013

Quick Guide to Getting Started with:

LabVIEW Basics. Based on LabVIEW 2011 Student Edition

Lab 7: Python Loops and Images 1

Introduction to Excel

Labview Lab 2. Vern Lindberg. April 16, 2012

Beginner s Guide to Microsoft Excel 2002

BEAWebLogic Server. Using the WebLogic Diagnostic Framework Console Extension

SCRATCH MODULE 3: NUMBER CONVERSIONS

LabVIEW VI Analyzer Toolkit

USING AUDACITY: ROBUST, FREE, AND FULL- FEATURED SOFTWARE

Contents Part I: Background Information About This Handbook... 2 Excel Terminology Part II: Advanced Excel Tasks...

CS 102 Lab 3 Fall 2012

A project is the basic file type in Cubase, in the same way that a document is the basic file type in Microsoft Word.

Linear Control Systems LABORATORY

LABVIEW LAB SKILLS ACTIVITY 1 PROGRAMING ENVIRONMENT

LabVIEW & FRC. BAA Fall Education Day 2015

Introduction to Sequence

RoboDAQ7. By John Buzzi. Masters of Engineering Report. Cornell University

CLAD Exam Preparation Guide using LabVIEW NXG

The LabVIEW Programming Environment and Basic Operations

Figure 1: Control & Simulation Loop

Experiment 1: Introduction to Labview 2010 (tbc 1/7/2007, 1/13/2009,1/9/2012, 1/10/2012)

Transcription:

References: 1. http://www.ni.com/labview/ 2. http://en.wikipedia.org/wiki/labview Introduction: This lab continues from the previous lab by showing additional basic features of LabVIEW including For loops, arrays, dynamically built arrays, graphing, polymorphism, subvis, express VIs, and audio playback. Procedure: Part 1: Iteration in LabVIEW To understand the two looping mechanisms in LabVIEW: while and for. As seen in the previous lab, one way to handle iteration in LabVIEW is with a while loop. While loops are typically used when the number of loop iterations is not known in advance, thus the loop must continue while (or until ) some condition is reached. Sometimes the number of loops needed is known in advance; in these scenarios we use LabVIEW s for loop mechanism. To demonstrate this, let s have LabVIEW answer the question what is the sum of the numbers from 1 to 100? 1. Launch LabVIEW as done previously. 2. Click Create Project. Make sure Blank Project is selected then click Finish. This should open a LabVIEW project explorer window to your new project. Save your new project as Lab12. 3. Right-click on My Computer and create a new VI. Save it as Sum100.vi. 4. On the block diagram, place a Programming -> Structures -> For Loop as shown in figure 1. Note the N which sets the number of times the For loop is repeated and the i which represents the iteration number (i.e. index ) during execution. 5. Add a shift register to the For loop as was done previously with a While loop. Also place Add and Increment operators, wired as shown. Finally, set the constants as shown and add in Indicator to the shift register output. Figure 1: Sum100.vi Block Diagram 6. Note that the For loop index variable i starts at zero; hence the Increment operator so that we sum the numbers 1..100 instead of 0..99. Run your program and verify the answer to the above question. Hint: http://mathcentral.uregina.ca/qq/database/qq.02.06/jo1.html 7. Challenge: reconfigure this VI to accept a value for N from the user and solve arbitrary N problems. (That s the Greek letter sigma which means summation in mathematics.) 8. You may now save and close this VI. 1

Part 2: Arrays in LabVIEW To understand how LabVIEW represents and handles arrays of data. To demonstrate how to visualize data in LabVIEW using its graphing features. One of many impressive features of LabVIEW is its ability to handle and manipulate arrays with ease. An array is a linear collection of similar data values; for example an array of lottery numbers or an array of digitized voice samples. Another neat feature of LabVIEW is its ease in which we can visualize data using its graphing capabilities. Let s explore both of these features. 9. In the LabVIEW project explorer window, create another new VI and save it as Arrays.vi. 10. Refer to figure 2 to build this front panel. Right-click on the front panel and from the Modern -> Array, Matrix & Cluster subpalette, place four Array shells. Rename them to Array1, Array2, Array1*Scale, and Array1+Array2. Within each array shell, place a Modern -> Numeric -> Numeric Indicator which instantly defines each array as an array of numeric data. Resize the height of each array indicator to display 10 elements. 11. Also add a Modern -> Numeric -> Numeric Control and a Modern -> Waveform -> Waveform Graph. Relabel the numeric control to Scale. On the waveform graph, double-click on the X-axis label Time and change it to Element No.. Relabel the Y-axis to Value. You can also reposition and resize the graph legend to show 4 plot legend keys. 12. Refer to figure 3 to build the block diagram for this VI. Figure 2: Arrays.vi Front Panel Tips: The Array and Scale icons are shown in mini icon mode; right-click on each and uncheck View As Icon. Programming -> Array -> Build Array is configured to build a 2D array of arrays from 4 individual input arrays. Right-click it and choose Add Input or simply resize it to have 4 inputs. Also on the right-click menu, make sure Concatenate Inputs is unchecked. 2

Figure 3: Arrays.vi Block Diagram Dissecting this block diagram, the For loop creates two 10-element arrays using the neat tunnel feature, the first containing random values and the second containing the integer sequence 0,1,2..9. Recall orange indicates floating-point data and blue indicates integer data. These generated arrays go to the front panel along with a second pair of arrays resulting from add and multiply operations. The four arrays are then smashed up into a 2D array of arrays which finally get displayed on the front panel graph. Notice how LabVIEW shows scalars (single values) with a thin line while arrays are shown with thicker lines. Also, did you notice how you can freely mix scalars and arrays into a single operator (e.g. multiply)? This is a powerful concept called polymorphism in computer science and computer engineering which allows different forms (poly=many) of inputs and the operator or function will automatically adapt (morph=change) appropriately. How cool is that!? 13. Run your VI several times and verify the results on the graph display. If you get a flat line for Array1*Scale (i.e. an array of all zeros), you forgot to set the Scale control to a non-zero value. Adjust and rerun. Also try a negative Scale value! 14. Challenge: add a fifth array indicator labeled Array1*Array2 with appropriate changes to the block diagram. Include this 5 th array on the graph as well. Review the block diagram you just completed noting how little time it took you to develop it and the amount of work accomplished therein. It is interesting to note that this LabVIEW program does the equivalent of some 300-500 lines of code in a text-based object-oriented language such as C++, which would also consume many hours of development time! 3

Part 3: LabVIEW Blackjack, take 2 To show the application of a dynamically built array to represent a hand of cards as an improvement to the previous LabVIEW implementation of Blackjack. One problem we had in our previous implementation of Blackjack was that only the last card dealt and the total hand value was shown. Wouldn t it be spiffy if we could see all of the cards in the hand as the cards are being dealt? Bet you ve already guessed what we ll do in this part 15. Using Windows Explorer, find your Blackjack2.vi from your previous LabVIEW project. Copy (i.e. duplicate, don t just move) it into your new Lab12 folder. 16. From the LabVIEW Project Explorer, right-click on My Computer and select Add -> File. Select your copied Blackjack2.vi. Open this VI then from the front panel window, File -> Save As -> Rename then Continue Name this new version Blackjack3.vi. 17. Referring to figure 4 and the tips below, modify the block diagram as shown. The old Card # has been deleted, Current Card has been replaced with Hand and a new # Cards has been added. Tips: Figure 4: Blackjack3.vi Block Diagram Note the addition of a second shift register to accumulate the individually dealt cards into a Hand. The Array Constant is found in the Programming -> Array subpalette. Remember that as with the array indicators in part 2 above, this is just a shell until you insert a Programming -> Numeric -> Numeric Constant into the shell. The Insert Into Array and Array Size are also found in the Programming -> Array subpalette. The easiest way to add the Hand array indicator is to right-click on the blue line output of Insert Into Array and Create -> Indicator. On the front panel, resize the Hand array indicator to show at least 6 elements (cards) in the array. 4

18. Once you complete the mods, save the VI then run it a few times to see how it works. You should notice the Hand array dynamically grow each time the While loop iterates. 19. Show all three of your completed VIs to the instructor for completion credit of this lab. Challenge: instead of showing the cards as numeric 1..11 values on the front panel, show actual card images for each card (sike! Save this for a future course?) Part 4: Do you hear what I hear? To demonstrate basic audio capabilities of LabVIEW via calling a built-in subvi. To demonstrate an example of a LabVIEW express VI. Over the years, National Instruments and LabVIEW enthusiasts worldwide have developed a huge LabVIEW ecosystem of hardware and software IP (Intellectual Property). A large part of this ecosystem is built into current versions of LabVIEW. Two such areas of support available in LabVIEW are audio and image file handling. This part explores basic reading and playback of WAV audio files. 20. Per instructor instructions, acquire and save a copy of the given WAV audio file. 21. In your LabVIEW project explorer window, create another new VI and save it as PlayWav.vi. 22. Using figure 5 as a guide, place a Sound File Read Simple on your block diagram then add and connect a path control and a Waveform Chart to it. Note that this is the first you ve seen a VI invoked from within a VI; indeed, this subvi mechanism is equivalent to calling subroutines and functions in text-based languages. Figure 5: PlayWav.vi 23. Before running this VI, click on the folder icon adjacent to the path control then navigate to and click on the WAV audio file you saved above. Then run this VI. You should see a waveform displayed that looks like realtime audio. But what does it sound like? 24. As shown in figure 6, add a Programming -> Graphics & Sound -> Sound -> Output -> Play Waveform to your block diagram. Note that the blue shading of this element indicates it is an Express VI which is specially configurable by double-clicking. Do this, confirm the Device is correctly set and click Test Device. You should hear an audio test sound. Click OK then run this VI to have your ears process and decode the secret audio message. 5

Figure 6: PlayWav.vi with Play Waveform Express VI added 6 21-Nov-2013 :js