Getting Started with LabVIEW Virtual Instruments

Similar documents
Linear Control Systems LABORATORY

LabVIEW. Getting Started with LabVIEW. Getting Started with LabVIEW

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

Homework Assignment 9 LabVIEW tutorial

LabVIEW Express VI Development Toolkit User Guide

2 Lab 2: LabVIEW and Control System Building Blocks

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

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

Introduction to LabVIEW

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

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

The LabVIEW Programming Environment and Basic Operations

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

Lab Exercise 2: Data Acquisition with NI LabVIEW

Table 1. Inputs and Outputs

LabVIEW programming I

CISE 318: Computer Control Systems Laboratory Exercises

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

OpenStax-CNX module: m Thermometer VI * National Instruments

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

Lab 4 - Data Acquisition

Lesson 4 Implementing a VI

Hardware: Acquiring Data and Communicating with Instruments

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

Tutorial: Getting Started with the LabVIEW Simulation Module

Virtual Instrumentation With LabVIEW

Virtual Instrumentation With LabVIEW

LabVIEW TM Basics I Introduction Course Manual

Figure 1: Control & Simulation Loop

Basic Data Acquisition with LabVIEW

Small rectangles (and sometimes squares like this

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

National Instruments Corporation 1 Introduction to LabVIEW Hands-On

Read Temperature Data

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

Beginner s Guide to Microsoft Excel 2002

Introduction to LabVIEW 6-Hour Hands-On

Introduction to LabVIEW

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

REV 1. Quick Start Guide. MBE Control Solutions

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

Lab 1: Getting familiar with LabVIEW: Part I

Introduction to LabVIEW

GET TO KNOW FLEXPRO IN ONLY 15 MINUTES

Virtual Instruments with LabVIEW

Getting Started with the LabVIEW Real-Time Module

PowerPoint X. 1. The Project Gallery window with the PowerPoint presentation icon already selected. 2. Click on OK.

Dive Into Visual C# 2008 Express

Pen Tool, Fill Layers, Color Range, Levels Adjustments, Magic Wand tool, and shadowing techniques

LabVIEW TM Core 1 Course Manual

LabVIEW VI Analyzer Toolkit

AEMLog Users Guide. Version 1.01

Exercise 5: Basic LabVIEW Programming

PowerPoint Launching PowerPointX

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

Slides & Presentations

Using Microsoft Word. Paragraph Formatting. Displaying Hidden Characters

Microsoft Word 2011: Basic Tutorial

Microsoft PowerPoint 2013 Beginning

Computer Interfacing Using LabView

Work Smart: Microsoft Office 2010 User Interface

One possible window configuration preferences for debug cycles

Creating a PowerPoint Presentation

Getting Started with the LabVIEW Datalogging and Supervisory Control Module

Introduction to LabVIEW. By Finn Haugen, TechTeach

Snap Shot. User Guide

Microsoft PowerPoint 2010 Beginning

Lab 2: Introduction to LabVIEW 8.5

Microsoft PowerPoint 2007 Beginning

Introduction to LabVIEW Exercise-1

Microsoft. Computer Training Center 1515 SW 10 th Avenue Topeka KS

Biopac Student Lab 4.1 BSL PRO TUTORIAL. BIOPAC Systems, Inc. Windows 10, 8, 7 Mac OS X

BD CellQuest Pro Analysis Tutorial

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

LabView programming 練習

Application of Skills: Microsoft Excel 2013 Tutorial

AutoCAD 2009 User InterfaceChapter1:

MICROSOFT WORD 2010 BASICS

LogicStudio Training Guide

1. Move your mouse to the location you wish text to appear in the document. 2. Click the mouse. The insertion point appears.

TABLE OF CONTENTS TABLE OF CONTENTS... 1 INTRODUCTION... 2 USING WORD S MENUS... 3 USING WORD S TOOLBARS... 5 TASK PANE... 9

A. Front Panel Design Lesson 4 Implementing a VI

LabVIEW FPGA Module Release Notes

Word Tips & Tricks. Status Bar. Add item to Status Bar To add an itme to the status bar, click on the item and a checkmark will display.

Learn LabVIEW 2010 / 2011 Fast

Contents. Group 2 Excel Handouts 2010

Microsoft Word: Steps To Success (The Bare Essentials)

Chemistry Excel. Microsoft 2007

Getting to Know FlexPro in just 15 Minutes

Microsoft Excel Lab: Data Analysis

Introduction to Microsoft Office 2016: Word

Lab 4: Pass the Data Streams to a Match Processor and Define a Match Rule

TOP Server Client Connectivity Guide for National Instruments' LabVIEW

1 Place the iworx/214 unit on the bench, close to the computer. 3 When the dialog box appears, select ahk214.iws and then click Load.

Experiment 1: The LabScribe Tutorial

Tutorial 01 Quick Start Tutorial

Introduction to National Instruments LabVIEW and Data Acquisition (DAQ)

Basic Microsoft Excel 2007

Reference Services Division Presents WORD Introductory Class

Introduction to MS Word XP 2002: An Overview

Transcription:

Getting Started with LabVIEW Virtual Instruments Approximate Time You can complete this exercise in approximately 30 minutes. Background LabVIEW programs are called virtual instruments, or VIs, because their appearance and operation imitate physical instruments, such as oscilloscopes and multimeters. LabVIEW contains a comprehensive set of tools for acquiring, analyzing, displaying, and storing data, as well as tools to help you troubleshoot code you write. In LabVIEW, you build a user interface, or front panel, with controls and indicators. Controls are knobs, push buttons, dials, and other input mechanisms. Indicators are graphs, LEDs, and other output displays. After you build the user interface, you add code using VIs and structures to control the front panel objects. The block diagram contains this code. You can use LabVIEW to communicate with hardware such as data acquisition, vision, and motion control devices, as well as GPIB, PXI, VXI, RS232, and RS485 instruments. Overview In the following exercise, you will build a VI that generates a signal and displays that signal in a graph. You will build and customize a user interface that allows you to control the amplitude of the signal and easily display your data. 1

Completed Exercise 2

Step-by-Step Instructions 1. Launching LabVIEW The Getting Started window appears when you launch LabVIEW. You can open the LabVIEW Getting Started window by doing either of the following: a. Double-click the LabVIEW icon on your desktop, or b. In the Windows Start menu, navigate to Programs» National Instruments» LabVIEW 8.5» LabVIEW The Getting Started window is used to create new VIs, view the most recently opened LabVIEW files, find examples, and launch the LabVIEW Help. You also can access information and resources to help you learn about LabVIEW, such as specific manuals, help topics, and resources on the National Instruments Web site, ni.com. The Getting Started window disappears when you open a VI and reappears when you close all open files. You can also display the window from an open VI by selecting View» Getting Started Window. 3

2. Opening a New VI from a Template LabVIEW provides built-in template VIs that include the functions, structures, and front panel objects you need to get started building common measurement applications. Complete the following steps to create a VI that generates a signal and displays it on the front panel: a. In the Getting Started window, click the More link to display the New dialog box. b. From the Create New list, select VI» From Template» Tutorial (Getting Started)» Generate and Display. This template VI generates and displays a signal. 4

c. A preview and a brief description of the template VI appear in the Description section. The following figure shows the New dialog box and the preview of the Generate and Display template VI. d. Click the OK button to create a VI from the template. e. LabVIEW displays two windows: the Front panel window (gray background) and the block diagram window (white background). Examine the Front panel window. The user interface, or Front panel, includes controls and indicators. The title bar indicates that this window is the Front panel for the Generate and Display VI. You can switch between the front panel window and block diagram window at any time by pressing the <Ctrl-E> keys. You can also select Window» Show Front Panel or Window» Show Block Diagram to switch between the two. f. Select Window» Show Block Diagram and examine the block diagram of the VI. The block diagram appears with a white background and includes VIs and structures that control the front panel objects. The title bar indicates that this window is the block diagram for the Generate and Display VI. g. On the front panel toolbar, click the Run button. You also can press the <Ctrl-R> keys to run a VI. A sine wave appears on the front panel graph. h. Stop the VI by clicking the STOP button, on the front panel. 5

3. Adding a Control to the Front Panel Controls on the front panel simulate the input mechanisms on a physical instrument and supply data to the block diagram of the VI. Many physical instruments have knobs you can turn to change an input value. Complete the following steps to add a knob control to the front panel: Throughout the exercise, you can undo recent edits by selecting Edit» Undo from the toolbar or pressing the <Ctrl-Z> keys. a. If the Controls palette is not visible on the front panel select View» Controls Palette from the toolbar. b. You can right-click any blank space on the front panel to display a temporary version of the Controls palette. The Controls palette appears with a thumbtack icon in the upper left corner. Click the thumbtack to pin the palette so it is not temporary. 6

c. The Controls palette opens with the Express subpalette visible by default. Click the double arrows at the bottom of the Controls palette if this subpalette is not visible. d. Move your cursor over the icons on the Express subpalette. Notice that the name of each subpalette, control, or indicator appears in a tip strip below the icon. e. Click the Numeric Controls icon to display the Numeric Controls palette. f. Left-click the knob control on the Numeric Controls palette to attach the control to the cursor g. Place the knob on your front panel to the left of the waveform graph. You will use this knob in a later exercise to control the amplitude of a signal. h. Select File» Save As and save the VI to the desktop as Acquiring a Signal.vi 7

4. Changing a Signal Type The block diagram has a blue icon labeled Simulate Signal. This icon is the Simulate Signal Express VI. The Simulate Signal Express VI simulates a sine wave by default. Complete the following steps to change this simulated signal to a sawtooth wave: a. Display the block diagram by pressing the <Ctrl-E> keys or clicking the block diagram. b. Locate the Simulate Signal Express VI. An Express VI is a component of the block diagram that you can configure to perform common measurement tasks. The Simulate Signal Express VI simulates a signal based on the configuration specified. c. Double-click the Simulate Signal Express VI to display the Configure Simulate Signal dialog box. This can also be done by right-clicking the VI and selecting Properties. d. Select Sawtooth from the Signal type pull-down menu. Notice that the waveform graph in the Result Preview changes to a sawtooth wave. e. Click the OK button to save the current configuration and close the dialog box. f. Move the cursor over the down arrows at the bottom of the Simulate Signal Express VI. When the cursor changes to a doubleheaded arrow and handles appear on the VI, click and drag the bottom handle down to display hidden inputs and outputs. g. When you release the mouse, the Amplitude input appears. You can configure the amplitude of the sawtooth wave programmatically now that it appears on the block diagram. Amplitude is also an option in the Configure Simulate Signal dialog box. You can configure several inputs for Express VIs in either location. 8

5. Wiring Objects on the Block Diagram To use the knob to change the amplitude of the signal, you must connect two objects on the block diagram. Complete the following steps to wire the knob to the Amplitude input of the Simulate Signal Express VI: a. On the block diagram, move the cursor over the Knob terminal. b. The cursor becomes an arrow, or the Positioning tool. Use the Positioning tool to select, position, and resize objects. c. Use the Positioning tool to select the Knob terminal and make sure it is to the left of the Simulate Signal Express VI and inside the gray loop. d. Deselect the Knob terminal by clicking a blank space on the block diagram. e. Move the cursor over the arrow on the right-hand side of the Knob terminal. f. The cursor becomes a wire spool, or the Wiring tool. The Wiring tool is used to connect objects together on the block diagram. g. When the Wiring tool appears, click the arrow on the Knob terminal and then click the arrow on the Amplitude input of the Simulate Signal Express VI, this wires the objects together. h. A wire appears and connects the two objects. Data flows along this wire from the Knob Terminal to the Express VI. i. Select File» Save to save the VI. 9

6. Running a VI What you have done so far is add a knob control that allows you to programmatically change the amplitude of a Sawtooth wave. Running a VI executes the LabVIEW graphical code you just created. Complete the following steps to run the Acquiring a Signal VI: a. Display the front panel by pressing the <Ctrl-E> keys or by clicking the front panel. b. Click the Run button or press the <Ctrl-R> keys to run the VI. c. Move the cursor over the knob control. d. The cursor becomes a hand, or the Operating tool. Use the Operating tool to change the value of a control. e. Using the Operating tool, turn the knob to adjust the amplitude of the sawtooth wave. The amplitude of the sawtooth wave changes as you turn the knob. The y-axis on the graph scales automatically to account for the change in amplitude when autoscale is selected. f. To indicate that the VI is running, the Run button changes to a darkened arrow. You can change the value of the controls while a VI runs, but you cannot edit the VI. g. Click the STOP button to stop the VI. The STOP button stops the VI after the VI completes the current iteration. The Abort Execution button in the toolbar stops the VI instantly, before the VI finishes the current iteration. Aborting a VI that uses external resources, such as external hardware, might leave the resources in an unknown state. Design VIs with a Stop button to avoid this problem. 10

7. Modifying a Signal Complete the following steps to add scaling to the simulated signal and display the results in the graph on the front panel: a. On the block diagram, left-click the wire that connects the Simulate Signal Express VI to the Waveform Graph to highlight the wire. b. Press the <Delete> key to remove this wire. c. If the Functions Palette is not visible, select View» Functions Palette to display it or simply right-click on the block diagram. The Functions Palette opens with the Express subpalette visible by default. If you have selected another subpalette, you can return to the Express subpalette by clicking Express on the Functions palette. d. On the Arithmetic & Comparison subpalette, select the Scaling and Mapping Express VI. Place it on the block diagram inside the loop between the Simulate Signal Express VI and the Waveform Graph terminal. Move the Waveform Graph terminal if necessary. 11

e. The Configure Scaling and Mapping dialog box opens when you place the Express VI on the block diagram. Define the scaling factor by entering 10 in the Slope (m) text box. f. Click the OK button to save the current configuration and close the Configure Scaling and Mapping dialog box. g. Move the cursor over the arrow on the Sawtooth output of the Simulate Signal Express VI. When the Wiring tool appears, click the arrow on the Sawtooth output and then click the arrow on the Signals input of the Scaling and Mapping Express VI to wire the two objects together h. Use the Wiring tool to wire the Scaled Signals output of the Scaling and Mapping Express VI to the Waveform Graph terminal. i. Examine the wires connecting the Express VIs and terminals. The arrows on the Express VIs and terminals indicate the direction of data flow along these wires. 12

8. Displaying Two Signals on Your Graph To compare the signal generated by the Simulate Signal Express VI and the signal modified by the Formula Express VI on the same graph, use the Merge Signals function. Complete the following steps to display two signals on the same graph: a. Wire the Sawtooth output to the Waveform Graph terminal. b. The Merge Signals function automatically appears where the two wires connect. A function is a built-in execution element, comparable to an operator or statement in a text-based programming language. The Merge Signals function takes two signals and combines them so that both can display on the same graph. Be sure to start the wiring at the Sawtooth output to avoid creating a feedback node. c. Press the <Ctrl-S> keys or select File» Save to save the VI. d. From the front panel, run the VI, and turn the knob control. e. Click the STOP button to stop the VI. The graph plots the wave and the scaled wave. The maximum value on the y-axis automatically changes to be 10 times the knob value. This scaling occurs because you configured the Scaling and Mapping Express VI to generate a slope of 10. 13

9. Customizing a Knob Control The knob control changes the amplitude of the sawtooth wave, so labeling it Amplitude accurately describes the behavior of the knob. Complete the following steps to customize the appearance of the knob: a. Right-click the knob and select Properties from the shortcut menu to display the Knob Properties dialog box. b. In the Label section on the Appearance page, delete the label Knob, and enter Amplitude in the text box. c. Click the Scale tab and in the Scale Style section, place a checkmark in the Show color ramp checkbox. d. Click the OK button to save the current configuration and close the Knob Properties dialog box. The knob on the front panel updates to reflect these changes. e. Save the VI. f. Reopen the Knob Properties dialog box and experiment with other properties of the knob. For example, on the Scale page, try changing the colors for the Marker text color by clicking the color box. Click the Cancel button to avoid applying any changes you made while experimenting. If you want to keep the changes you made, click the OK button. 14

10. Customizing a Waveform Graph The waveform graph indicator displays the two signals. To indicate which plot is the scaled signal and which is the simulated signal, you can customize the plots. Complete the following steps to customize the appearance of the waveform graph indicator: a. Though the graph has two plots, the legend displays only one plot. On the front panel, move the cursor over the top of the plot legend on the waveform graph. b. When the cursor changes to a double-headed arrow and handles appear, click and drag the top handle of the legend to add one item. When you release the mouse button, the second plot name appears. c. Right-click the waveform graph and select Properties from the shortcut menu to display the Waveform Graph Properties dialog box. d. On the Plots page, select Sawtooth from the pull-down menu. e. In the Colors section, click the Line color box to display the color picker. Select a new line color. 15

f. Select Sawtooth (Scaled) from the pull-down menu. g. Place a checkmark in the Ignore Waveform or Dynamic Attributes, Including Plot names checkbox at the bottom of the dialog. h. In the Name text box, delete the current label and change the name of this plot to Scaled Sawtooth. The reason for placing a checkmark in the Ignore Waveform or Dynamic Attributes, Including Plot names checkbox is because this will display Scaled Sawtooth in the legend of the Waveform Graph instead of Sawtooth (Scaled) which would be scaled without placing that checkmark. i. Click the OK button to save the current configuration and close the Waveform Graph Properties dialog box. j. Reopen the Waveform Graph Properties dialog box and experiment with other properties of the graph. For example, on the Scales page, try disabling automatic scaling and changing the minimum and maximum value of the y-axis. Click the Cancel button to avoid applying any changes you made while experimenting. If you want to keep the changes you made, click the OK button. k. Run the VI. Notice the changes made. l. Save and close your VI. 16