LabVIEW - Practicum 4



Similar documents
Lab 4 - Data Acquisition

LabVIEW Day 6: Saving Files and Making Sub vis

Exercise 10: Basic LabVIEW Programming

EET 310 Programming Tools

HOW TO ORGANIZE PICTURES

Creating a table of contents quickly in Word

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

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

To Begin Customize Office

Creating tables of contents and figures in Word 2013

Excel 2007 Basic knowledge

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

How to make a line graph using Excel 2007

Gestation Period as a function of Lifespan

Crop and Frame Your Photos

TUTORIAL 4 Building a Navigation Bar with Fireworks

Word basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

A Beginner s Guide to PowerPoint 2010

Smart Connection 9 Element Labels

Evaluation copy. Build a Temperature Sensor. Project PROJECT DESIGN REQUIREMENTS

Microsoft PowerPoint 2010 Handout

First Bytes Programming Lab 2

Microsoft PowerPoint Exercises 4

Using the Cute Rich-Text Editor

Easy Setup Guide for the Sony Network Camera

Sharing Software. Chapter 14

Table of Contents. 0. Internet Connectivity Assumptions Identifying the Network Wall Jack Identifying the Ethernet Cable..

CREATE A 3D MOVIE IN DIRECTOR

Working with SQL Server Integration Services

Gmail: Signatures, labels, and filters

Tutorial 1: The Freehand Tools

Microsoft Word 2011: Create a Table of Contents

Statgraphics Getting started

Recipes4Success. Animate a Rocket Ship. Frames 6 - Drawing Tools

Introduction to LabVIEW

Using Microsoft Word. Working With Objects

Excel basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

Designing a Wine Label in CorelDRAW

After you complete the survey, compare what you saw on the survey to the actual questions listed below:

Migrating to Excel 2010 from Excel Excel - Microsoft Office 1 of 1

LabVIEW Tutorial Manual

Styles, Tables of Contents, and Tables of Authorities in Microsoft Word 2010

Embroidery Fonts Plus ( EFP ) Tutorial Guide Version

Windows 8.1 Update 1 Supplement

Microsoft Word Quick Reference Guide. Union Institute & University

Transitioning from TurningPoint 5 to TurningPoint Cloud - LMS 1

Taco Hydronic System Solutions Quick Start Guide

Search help. More on Office.com: images templates

Directions for Frequency Tables, Histograms, and Frequency Bar Charts

TLMC WORKSHOP: THESIS FORMATTING IN WORD 2010

Microsoft Migrating to Word 2010 from Word 2003

KaleidaGraph Quick Start Guide

Getting Started on the Computer With Mouseaerobics! Windows XP

paragraph(s). The bottom mark is for all following lines in that paragraph. The rectangle below the marks moves both marks at the same time.

ClarisWorks 5.0. Graphics

PowerPoint 2013: Basic Skills

Chapter 1. Creating Sketches in. the Sketch Mode-I. Evaluation chapter. Logon to for more details. Learning Objectives

Lab 3: Introduction to Data Acquisition Cards

HOW TO BURN A CD/DVD IN WINDOWS XP. Data Projects

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

Cerner Update October, 2010

Lession: 2 Animation Tool: Synfig Card or Page based Icon and Event based Time based Pencil: Synfig Studio: Getting Started: Toolbox Canvas Panels

Clip Art in Office 2000

Information Technology Solutions

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

Working With Animation: Introduction to Flash

Maximizing Microsoft Office Communicator

Power Point 2003 Table of Contents

Microsoft Publisher 2010 What s New!

Presentations and PowerPoint

MICROSOFT WORD TUTORIAL

SolidWorks Tutorial 3 MAGNETIC BLOCK

Using FileMaker Pro with Microsoft Office

CREATING BANNERS & IMAGES USING MS PAINT & ANIMATED PROGRAMS

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

Unit 21 - Creating a Button in Macromedia Flash

Handout: Word 2010 Tips and Shortcuts

Creating and Using Master Documents

Activity 5. Two Hot, Two Cold. Introduction. Equipment Required. Collecting the Data

WebEx Remote Access User s Guide

What is Microsoft PowerPoint?

Sharing Presentations, Documents, and Whiteboards

Adobe InDesign Creative Cloud

To launch the Microsoft Excel program, locate the Microsoft Excel icon, and double click.

5. Tutorial. Starting FlashCut CNC

The very basic basics of PowerPoint XP

Microsoft Office PowerPoint 2013

LESSON 7: IMPORTING AND VECTORIZING A BITMAP IMAGE

Sample Table. Columns. Column 1 Column 2 Column 3 Row 1 Cell 1 Cell 2 Cell 3 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Cell 7 Cell 8 Cell 9.

Microsoft Outlook 2007

Creating a Simple Visual C++ Program

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

Tutorial 13: Object Animation

Transitioning from TurningPoint 5 to TurningPoint Cloud - NO LMS 1

Microsoft PowerPoint 2010

Figure 3.5: Exporting SWF Files

TabletWorks Help Index 1

Collaborative Tools. Course groups can also use the Collaboration tools for private sessions open only to course group members.

Select the Crow s Foot entity relationship diagram (ERD) option. Create the entities and define their components.

CATIA Drafting TABLE OF CONTENTS

Transcription:

LabVIEW - Practicum 4 Creating and Using SubVI's Resources - This lab requires LabVIEW files: Temperature_Converter.VI and 4_Thermometers.vi. Instructions - Carefully work through each of the following examples. Then try the Achievement Test at the end to check your understanding. Contents Educational Objectives Introduction Example 1 - Review - Create a VI to convert Fahrenheit to Celsius and Kelvin. Example 2 - Editing the Default Icon Example 3 - How to define the connector terminals Example 4 - How to use a SubVI Example 5 - Conversion of Several Temperatures Achievement Test Educational Objectives After working through this lab the student should be able to: 1. Create a custom icon for a SubVI. 2. Assign the terminals on the connector pane using the wiring tool. 3. Choose a SubVI using the Select a VI... icon. Introduction This practicum focuses on how to create and use SubVI's in your LabVIEW programs. SubVI's are the LabVIEW version of subprograms. The use of SubVI's offers two significant advantages. 1. In programs requiring the same code many times, the use of SubVIs allows us to only program the code once. 2. Many of our examples have used virtual instruments such as the virtual thermometer. When it is time to replace the virtual thermometer with a real one, we need only replace its icon with that for the SubVI which really acquires the data. LabVIEW 4-1

Example 1 - Temperature Converter The simple temperature converter you create in this section, will be used in a later example. The program takes a Fahrenheit reading as input and outputs both the corresponding Celsius and Kelvin readings. The temperature conversion equations are: 5 C = ( F -32) K = C +273. 15 9 OK - Let's get started. Open a new LabVIEW document and create the following temperature converter. By now you should be able to create any VI just given a picture of its front panel and block diagram as below. Be sure to use the labeling tool to add the title and the little arrow that makes the purpose (conversion) of this VI much clearer. Be sure to test your VI by verifying that it correctly converts for 32 and 212 degrees Fahrenheit, the freezing and boiling points of water, respectively. Finally, be sure to save your work using the file name Temperature_Converter.vi Example 2 - Creating Your Own Icon The block diagram below, shows one possible use of our Temperature_Converter VI. In this example, four temperature readings are charted and each has to be converted from Fahrenheit to Celsius. Of course, you could just wire all the code from example 1 four times. Instead, we simply converted the Temperature_Converter.VI into a SubVI and used it for each conversion. Do not create the four temperature readings VI now. We will return to it later. LabVIEW 4-2

Custom Icons - Notice that a custom icon has been created for our temperature conversion program. This new icon makes it clear what the SubVI does and also communicates where to wire to obtain either the Celsius C or the Kelvin K outputs. In this example, we show how to create the above custom icon for the temperature converter VI you created in example 1. Block Diagram If you have closed it, open the file Temperature_Converter.vi that you created in Example 1. The figure below and to the right shows its front panel. The Default Icon - The icon in the upper right corner of this VI is the default icon created by LabVIEW for your VI. The number 1 on this icon indicates that this was the first VI we created in this session of LabVIEW. Unfortunately, nothing about the appearance of this default icon suggests that your VI is useful for temperature conversion nor does it suggest where to wire the terminals. The goal in this example is to create the new custom icon which better conveys the purpose of the VI. Front Panel To edit the icon you can either: 1. Double-click on the default icon. or 2. Pop-up on the default icon (Command+Click) and then choose Edit Icon from the resulting pop-up menu as shown. Whether you choose to double-click or pop-up on the default icon (and then choose edit icon) you will be presented with the Icon Editor dialog box shown below. LabVIEW 4-3

Palette of Paint Tools - On the left of the Icon Editor window appears a palette containing standard paint tools. For example, the icon indicates the select tool which one uses to select all the pixels within a rectangle and indicates the text tool which is used for drawing text. You should also recognize other familiar paint tools such as the Paint Bucket and the tools for drawing lines, curves and rectangles. First we will need to delete most of the old icon - we will keep only the outside rectangle which will make a nice frame for our custom icon. To do this, select the unwanted pixels using the select tool and then press the delete key as shown below. Select unwanted pixels Blank Icon with Frame Remaining Next use the Text Tool to draw the letters F, C and K as shown to the right. Of course these letters stand for the Fahrenheit, Celsius and Kelvin scales. If the letters are a little miss aligned, you can move them around by selecting their pixels and then using the arrow keys on the keyboard. Now use the line and pencil tools to create the arrow which indicates the conversion from F to either C or K. OK - That will do for the black and white icon. LabVIEW recommends that you always create at least the black and white icon because commercial and industrial users of your programs may wish to run them on monochrome equipment. If you do not have the black and white icon, no icon will appear! Next we will modify our black and white icon to create a 16 color icon as shown below. While in the Icon Editor window, select the option to edit the 16 color icon, then copy the black and white icon by clicking on the appropriate Copy from button and finally fill in the background with a nice color of your choice LabVIEW 4-4

using the Paint Bucket Tool. Click on OK and return to the front panel of your VI. Your custom icon should appear in the upper right corner of the front panel as shown below. This icon makes it clearer that your program can convert Fahrenheit to either Celsius or Kelvin. Importing Graphics - Those of us who are not artistically inclined may be a little worried about whether we can create nice looking icons. The good news is that you can copy any icon, paste it in and then modify as necessary. LabVIEW will convert the graphic to a 32 32 pixel icon. LabVIEW 4-5

Example 3 - How to Define The Connector Terminals Pop-up on your custom icon and choose Show Connector. Instead of the icon, you should now see the default connector. Notice the connector has one white rectangle on the left and two on the right. By default, LabVIEW creates one rectangle (terminal) for every control and indicator on your front panel. Thus there is one rectangle for the Fahrenheit control and one for each of the Celsius and Kelvin indicators. (But which is which?) LabVIEW let's the user control which terminal on the connector corresponds to which control or indicator. That is, we must assign the terminals - just as, for example, the various terminals on an amplifier or computer cable need to be defined. Each terminal on the connector is defined using three clicks of the wiring tool. We will assign the large terminal on the left to the Fahrenheit input, the small terminal on the top right to the Celsius indicator and the small terminal on the right to the Kelvin indicator as shown below. Fahrenheit Control Celsius Indicator Kelvin Indicator Assigning the Fahrenheit Terminal. Using the wiring tool, click on the large rectangle on the left of the connector. It should turn black to indicate it has been selected. Then click on the Fahrenheit control to select it - do not drag the mouse - just click again! Finally deselect the Fahrenheit control by clicking anywhere on the front panel. The terminal on the connector should now turn orange to indicate it has been successfully assigned. Assigning the Terminals for the Celsius and Kelvin Indicators Similarly, use three clicks with the wiring tool to assign the small rectangle on the top right of the connector to the Celsius indicator and then assign the remaining rectangle to the the Kelvin indicator. When you are done, all three terminals on the connector should appear orange to indicate they have been assigned. That's it, we are now ready to use your temperature conversion VI as a SubVI in any other program. LabVIEW 4-6

Example 4 - How to use a SubVI To illustrate how you can use your SubVI in another program, we will first demonstrate it with a simple example. We will create a program that just converts Fahrenheit to Celsius. Open a new LabVIEW file and place a Fahrenheit Control and Celsius indicator on the front panel as shown below. Now examine the block diagram shown above. The Fahrenheit input is wired directly into the left terminal of our SubVI and the desired Celsius value is wired to the indicator. Since we don't need the Kelvin value, its terminal is not wired. The only mystery still do be told is how to import your SubVIs into another program as we have above. The answer lies on the Functions Palette in the form of the Select a VI... icon. Clicking on this icon displays a dialog box which you can use to select any VI to import into your programs. Click on the Select a VI icon now and select Temperature_Converter.vi which we created in Example 1. Place the SubVI on the block diagram and complete the wiring as shown above. Test Drive! Input 212 o degrees on the front panel, turn on execution highlighting and run your VI. Watch to see the 212 o F flow into your SubVI and the desired 100 o Celsius flow out of it. Finally, alter the front panel and the wiring so that the VI displays both the Kelvin and the Celsius readings. LabVIEW 4-7

Example 5 - Pesky Europeans CNN s London bureau reports to its European audiences on weather conditions in America. But those pesky Europeans insist only the Celsius scale shall be used for all weather reports. Help out the London bureau of CNN by building a VI to convert temperatures for American cities into Celsius from Fahrenheit. Today s readings are: New York 100 F Philadelphia 90 F Chicago 80 F Your front panel should look like this. Obviously, it has not been run yet since 0 F 0 C. There are no tips for this one. You are on your own. However, we will point out that you can create interesting effects like the above arrows, labels and boxes using the Decorations subpalette available from the Controls Palette. LabVIEW 4-8

LabVIEW Lab 4 Quiz A Name ID # Section Grade: 1. Sketch the back panel for a subvi which converts a Fahrenheit temperature F to a temperature C in Celsius. The front panel is already given. (2 points) Front Panel Block Diagram 2. Create (using LabVIEW) the following icon. Show it to your TA for credit. (1 point) 3. Make a sketch showing how to connect two input temperatures F1 and F2 in Fahrenheit to Celsius using your subvi from question 1. The front panel is already given. (2 points) Front Panel Block Diagram LabVIEW 4-9

LabVIEW Lab 4 Quiz B Name ID # Section Grade: 1. Sketch the back panel for a subvi which converts a Celsius temperature C to a Fahrenheit temperature F. The front panel is already given. The conversion is given by: F = 32 + 9C/5 (2points) Front Panel Block Diagram 2. Create (using LabVIEW) the following icon. Show it to your TA for credit. (1 point) 3. Make a sketch showing how to connect two input temperatures C1 and C2 in Celsius to Fahrenheit using your subvi from question 1. The front panel is already given. (2 points) Front Panel Block Diagram LabVIEW 4-10