Small rectangles (and sometimes squares like this

Similar documents
ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

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

INTRODUCTION TO LABVIEW

Homework Assignment 9 LabVIEW tutorial

ENGR 1000, Introduction to Engineering Design

2 Lab 2: LabVIEW and Control System Building Blocks

Introduction to LabVIEW Exercise-1

Lab 4 - Data Acquisition

Computer Interfacing Using LabView

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

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

Lab Exercise 2: Data Acquisition with NI LabVIEW

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

OpenStax-CNX module: m Thermometer VI * National Instruments

Getting Started with LabVIEW Virtual Instruments

Introduction to LabVIEW

Linear Control Systems LABORATORY

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

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

Introduction to National Instruments LabVIEW and Data Acquisition (DAQ)

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

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

Virtual Instrumentation With LabVIEW

PHY 351/651 LABORATORY 1 Introduction to LabVIEW

Introduction to Labview and Temperature Measurement

Part 1. Creating an Array of Controls or Indicators

Basic Data Acquisition with LabVIEW

The LabVIEW Programming Environment and Basic Operations

LABVIEW LAB SKILLS ACTIVITY 1 PROGRAMING ENVIRONMENT

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

ME 224: EXPERIMENTAL ENGINEERING. Lecture 2

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

Introduction to LabVIEW

NAME EET 2259 Lab 3 The Boolean Data Type

LabVIEW programming I

ECE 202 LAB 1 INTRODUCTION TO LABVIEW

Read Temperature Data

ECE 463 Lab 1: Introduction to LabVIEW

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

Lab 1: Getting familiar with LabVIEW: Part I

Virtual Instrumentation With LabVIEW

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

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

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

EE 210 Lab Assignment #2: Intro to PSPICE

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

CISE 318: Computer Control Systems Laboratory Exercises

ENGR 1000, Introduction to Engineering Design

Labview. Masood Ejaz

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

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

LabVIEW programming I

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

DSP First Lab 02: Introduction to Complex Exponentials

1. Open PowerPoint and you will see the introductory screen that contains different themes and templates. From the selection displayed, choose Slice.

Figure 1: My Blocks are blue in color, and they appear in the Custom palette in NXT-G.

Lesson 4 Implementing a VI

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

Introduction to LabVIEW

Table 1. Inputs and Outputs

LabVIEW Express VI Development Toolkit User Guide

SystemVue 2011 Fundamentals (version ) LAB EXERCISE 1. SystemVue Basics

A. Front Panel Design Lesson 4 Implementing a VI

Data Acquisition Laboratory

PowerPoint 2010: Basic Skills

Recipes4Success. Draw and Animate a Rocket Ship. Frames 5 - Drawing Tools

PHYC 500: Introduction to LabView. Exercise 16 (v 1.2) Controlling hardware with DAQ device. M.P. Hasselbeck, University of New Mexico

Introduction to Electronics Workbench

Adobe PageMaker Tutorial

Tutorial: Getting Started with the LabVIEW Simulation Module

Session 7 MS Word. Graphics. Inserting Clipart, and Graphics Modify graphics Position graphics

LabVIEW Basics. Based on LabVIEW 2011 Student Edition

TECH 3821 Lab #2 Relay Driver with Computer Control

The Fundamentals. Document Basics

Using Inspiration 7 I. How Inspiration Looks SYMBOL PALETTE

Certified LabVIEW Associate Developer Examination

Concept: Debugging. Goal. Description. Implementation. Use the debugging tools built into 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.

Learn LabVIEW 2010 / 2011 Fast

DDX-R Quick Start Guide

1. Learn about LabView software and its different components

Strain and Force Measurement

Part 1: Basics. Page Sorter:

Capstone Appendix. A guide to your lab computer software

Certified LabVIEW Associate Developer Examination

HYPERSTUDIO TOOLS. THE GRAPHIC TOOL Use this tool to select graphics to edit. SPRAY PAINT CAN Scatter lots of tiny dots with this tool.

PowerPoint Basics (Office 2000 PC Version)

Certified LabVIEW Associate Developer Exam. Test Booklet

Word 2007 Tables Objectives

EXCEL SPREADSHEET TUTORIAL

Determination of Drag Coefficient

SOUTHERN POLYTECHNIC S. U.

Getting Started with DADiSP

POWERPOINT BASICS: MICROSOFT OFFICE 2010

BASIC MICROSOFT POWERPOINT

FRC LabVIEW Sub vi Example

Creating a Text Frame. Create a Table and Type Text. Pointer Tool Text Tool Table Tool Word Art Tool

One possible window configuration preferences for debug cycles

What s Inside. 1 Introducing Creating Visually Compelling Lectue Slides Access to Slide Creation Software Step- by- Step Examples...

Appleworks 6.0 Word Processing

Transcription:

Lab exercise 1: Introduction to LabView LabView is software for the real time acquisition, processing and visualization of measured data. A LabView program is called a Virtual Instrument (VI) because it, with the proper sensors, can simulate an electronic instrument such as an oscilloscope. Each VI is programmed in two windows: a front panel that provides the user interface, and a block diagram that does the data acquisition and mathematics. The block diagram uses a graphical programming interface that mimics the wiring between integrated circuits (op amps, microprocessors, etc.) within an electronic device. You can do the same mathematical functions in LabView that you can do in MATLAB, but LabView is good for real time operations while MATLAB is more efficient for post processing. The first part of this exercise is meant to get you familiar with the LabView interface. The second part starts a VI that you can use to do frequency domain analysis of acoustic signals. Part 1: Familiarization 1. Open National Instruments LabView, then click Find Examples in the lower right corner of the start window. Click the Search tab, search for running then open Calculate Running Average VI. The first window you see is the Front Panel, which contains one Control (the stop button) and one Indicator (a plot window). 2. By default, LabView automatically changes the pointer to match each object (e.g. cross, arrow, text cursor, hand/finger). If you would rather select the pointer yourself, select View >> Tools Palette, then click off the green bar. You can then choose any of the tools shown in the palette. Either way, try moving or resizing the displays using the arrow. 3. Select Help>>Show Context Help. Note that the Context Help window displays details about whichever component is under the mouse pointer. 4. If your VI is ready to run, there will be a white arrow in the upper left corner of the window. If not, there will be a broken gray arrow. Clicking on a broken gray arrow will bring up a list of errors so you can address them. 5. Run the VI by clicking the white arrow, or Operate >> Run, or ctrl R. The plot shows some random numbers (white diamonds) and a running average (green line). Press the STOP button to stop the VI. 6. Select Window>>Show Block Diagram. In it, the large gray rectangle represents a while loop. The green T/F box and tiny stop sign determine when the loop stops, and the watch in the yellow box controls how fast it runs. The red triangles on the left and right borders are Shift Registers, which store a number from one iteration of the loop to the next. There are three arrows on the left border because the previous three numbers are being stored for averaging. Small rectangles (and sometimes squares like this ) represent constants, Print date: 9/25/2012 1

inputs, or outputs. Rectangles with bold outlines typically represent controls (inputs from the front panel), while rectangles with narrow outlines are indicators (outputs to the front panel). The icons are connected by wires, as if the program were built in a circuit. The wires color and pattern indicate the data type that they carry. Some examples: blue for integer, red for floating point, green for logical (true/false); narrow line for scalar, thick line for 1 D array, double line for 2 D array. 7. Right click the block diagram to bring up the Functions palette, pin it to the desktop, then expand it with the down arrows at the bottom of the window. You might want to do Customize >> Change Visible Categories and select all. Then select Programming >> Structures, and note the variety of structures that are analogous to functions in standard programming code. For example, to put functions in a for next loop, you actually place icons and wires into the For Loop structure, or draw the loop around existing icons. Information enters on the left, is processed within, and exits on the right through tunnels. The structures of most importance to us are the While Loop, For Loop, Case Structure (equivalent to if then else code), and MATLAB Script node. If you do not see the MATLAB script icon in Programming, you might find it under Mathematics >> Scripts and formulas. The MATLAB Script node allows us to include MATLAB code in the LabView VI so that we do not need to program complicated mathematical formulas icon by icon. 8. While viewing the block diagram, run the VI. While it is running, click the light bulb (Highlight Execution) and observe the flow of data through the diagram. Note that highlighting execution slows down the VI. 9. Close the running average VI, search examples for moon and open the Moonlanding VI. Play for a while, but not too long. 10. Switch to the block diagram, and note the collection of large blue icons. Each of these is an interactive function box, called an Express VI. They can perform signal input & output, mathematics, file input and output, signal processing, and timing. You can double click on each of them to see the internal workings. 11. The Trigger and Gate VI does some functions similar to an oscilloscope, and the In Range VI does a comparison operation. These two operations could just as easily have been carried out by simpler functions for example, the Time Delay is equivalent to the millisecond constant and the watch icon that we saw in the Calculate Running Average VI earlier. In some cases, however, the Express VI s make our lives easier, especially when dealing with data acquisition and output. 12. Before moving to a data input/output example, note the blue dashed lines traversing the Moonlanding block diagram. This is LabView s Dynamic Data Type which means that it can represent any of a variety of signal types. It can be good for plotting acquired signals, but I often like to convert a signal to a simple array because arrays make it easier for me to use the raw data. Print date: 9/25/2012 2

Part 2: Your data acquisition VI for today 1. For this exercise you will need a function generator, data acquisition module, and a computer running LabView. Plug the DAQ module into the computer and use a BNC to spring clip cable to connect one of its analog inputs to the output from the function generator. 2. Generate a one volt sinusoid around 200 800 Hz. If you have an oscilloscope, verify your output signal. 3. Start a new, blank VI, and switch to the block diagram. You will want to acquire a voltage signal, so place this icon on the diagram: Functions > Express > Input > DAQ Asst. Use one channel, a sampling frequency of 1000 Hz and 500 samples. Click OK. 4. Expand the DAQ Asst icon by dragging down the lower border. Right click the Data output triangle, and Create > Graph indicator. 5. Switch to the front panel and run the VI. After one second you should see a signal on the graph (probably noise). 6. You want your VI to run continuously, so add a While loop on the block diagram. Drag the loop around both icons. Right click the stop sign in the lower right corner and Create > control. Double click the Stop icon, and it will be highlighted on the front panel. Run the VI, and notice that you can stop it by pressing the Stop button. 7. On the block diagram, on the Acquire sound icon, right click the Duration input triangle and Create > Control. On the front panel, enter 0.5 in the Duration (s) field. When you run the VI the chart should update itself every 0.5 seconds. 8. You can multiply the sampling rate by the duration and find the number of samples that are supposed to be in each signal. However, the actual signal often has fewer, and this is very important for frequency analysis. Let s see how many samples we get. Place a Programming > Array > Array size icon near the Data graph icon. Wire the Array size input to the Data signal (the blue wire). You should see a new icon that changes the blue wire to a red one, i.e. a Dynamic Data Type to a simple Array. Right click the Array Size output and Create > Indicator. The indicator on the front panel will show the number of samples collected in each iteration of the While loop. 9. Now it is time for you to apply your knowledge of discrete Fourier transforms to add frequency measurement functionality to your VI. ON PAPER, write a flow chart that shows how you will take your signal and determine the dominant frequency (the one with highest amplitude) over the duration when you captured the signal. Be as detailed as you can. Show the flow chart to the instructor and you will get help finding the functions you need. Print date: 9/25/2012 3

10. To save data: Select a file save icon via Programming>>File I/O >> Write Meas File (or Express>>Output>>Write Meas File) and place it to the right of the loop. In the dialog box, browse to the folder where you would like to store the data. Suggestions: check Ask user to choose file, and One column only in the X Value Columns choices. After you have clicked OK, expand the blue box downward to see all of the possible inputs and outputs. 11. Right click the right border of the While loop, and select Add shift register. Note that triangles appear on both the left and right borders. 12. Select Programming>>Array>>Initialize Array and place the icon to the left of the loop. Expand the icon to make it taller, thereby adding one dimension (it is also possible to right click on a dimension input and select Add dimension). Wire [0] to all three inputs. This creates a 2 D array of size 0 0 (weird, but effective). 13. Place an Array>>Build Array icon inside the loop. 14. Wire the initialized array into the left hand shift register icon, then continue to the top input of the Build Array icon. Connect the output of the From DDT icon to the lower array input; this appends new data to the existing array. 15. Wire Build Array output to the right hand shift register, and then into the Signals input of the Write To Measurement File. You should be able to run the VI now. 16. General notes: a) Charts collect incoming data in a buffer, so one datum per loop is sufficient. Graphs discard all previously received data, so one point per loop is not enough. b) Controls and indicators may be interchanged by selecting Change to on the right click menu. Note that the appearance usually changes on both the diagram and the front panel. c) On the front panel, pressing the space bar toggles the mouse pointer between the finger (change input) and arrow (move/size display). On the diagram, the space bar cycles the pointer through the wire, arrow and finger. d) By default, new controls and indicators show up on the block diagram as squares like this. You can make them smaller by right clicking and unchecking show as icon. Control/indicator icons with bold outlines on the block diagram are represent controls on the front panel, while rectangles with narrow outlines represent indicators. e) Any VI can be used as a subroutine within a larger VI. Typically these sub VIs appear as white squares, which can be opened and edited (right click > Open front panel). They perform a variety of procedures and complicated mathematical functions. Print date: 9/25/2012 4

f) When complicated instrument drivers are involved, the fastest way to get the program you need is often to modify one of the example VI s. Open Help>>Examples>>I/O Interfaces>>DAQ Examples; the Analog Input and Analog Output lists contain the most useful starting points for our data acquisition hardware. Extra exercises not necessary, but useful. Inside the while loop, create a case structure and place a different string constant in each case window. Right click the green [?] box and Create control. Right click one string constant, Create indicator; move the indicator outside the case box; wire the string constant to the indicator, switch to the other case, and wire that string to the indicator. Return to the front panel and run. Use what you learned from the previous exercise to put the Write Measurement File icon inside a case structure. Create a Boolean control inside the while loop, and wire it to the conditional [?] terminal of the case structure. This way, you should be able to control from the front panel whether your VI attempts to save your data. If time permits, ask an instructor how to control and display the loop rate. Print date: 9/25/2012 5