Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Getting Started with LabVIEW: Editing NI-DAQmx Tasks and Using Other LabVIEW Features - Pr, Lab Reports of Mechanical Engineering

A chapter from the labview getting started manual, focusing on editing ni-daqmx tasks and using other labview features. It covers topics such as communicating with instruments, acquiring and parsing information, wiring commands, and using various labview controls and indicators. It also provides instructions for creating custom indicators and modifying the front panel.

Typology: Lab Reports

Pre 2010

Uploaded on 08/16/2009

koofers-user-mbh
koofers-user-mbh 🇺🇸

4

(1)

10 documents

1 / 102

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LabVIEWTM
Getting Started with LabVIEW
Getting Started with LabVIEW
August 2006
323427C-01
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Getting Started with LabVIEW: Editing NI-DAQmx Tasks and Using Other LabVIEW Features - Pr and more Lab Reports Mechanical Engineering in PDF only on Docsity!

LabVIEW

TM

Getting Started with LabVIEW

Getting Started with LabVIEW

August 2006 323427C-

Support

Worldwide Technical Support and Product Information

ni.com

National Instruments Corporate Headquarters

11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100

Worldwide Offices

Australia 1800 300 800, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599, Canada 800 433 3488, China 86 21 6555 7838, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 385 0 9 725 725 11, France 33 0 1 48 14 24 24, Germany 49 0 89 741 31 30, India 91 80 41190000, Israel 972 0 3 6393737, Italy 39 02 413091, Japan 81 3 5472 2970, Korea 82 02 3451 3400, Lebanon 961 0 1 33 28 28, Malaysia 1800 887710, Mexico 01 800 010 0793, Netherlands 31 0 348 433 466, New Zealand 0800 553 322, Norway 47 0 66 90 76 60, Poland 48 22 3390150, Portugal 351 210 311 210, Russia 7 095 783 68 51, Singapore 1800 226 5886, Slovenia 386 3 425 4200, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 0 8 587 895 00, Switzerland 41 56 200 51 51, Taiwan 886 02 2377 2222, Thailand 662 278 6777, United Kingdom 44 0 1635 523545

For further support information, refer to the Technical Support and Professional Services appendix. To comment on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter the info code feedback.

© 2003–2006 National Instruments Corporation. All rights reserved.

DAMAGE, INJURY, OR DEATH, THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS. BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN, PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.

© National Instruments Corporation v Getting Started with LabVIEW

Contents

About This Manual

Conventions ...................................................................................................................ix

Contents

© National Instruments Corporation vii Getting Started with LabVIEW

Visually Comparing Two Voltage Readings...................................................4- Communicating with an Instrument ..............................................................................4- Finding and Installing Instrument Drivers (Windows and Linux) ..................4- Selecting an Instrument Using the Instrument I/O Assistant ..........................4- Acquiring and Parsing Information for an Instrument ....................................4- Wiring a Command to an Instrument ..............................................................4- Summary ........................................................................................................................4- DAQ Assistant Express VI..............................................................................4- Tasks................................................................................................................4- Instrument Drivers...........................................................................................4- Instrument I/O Assistant Express VI...............................................................4-

Chapter 5

Using Other LabVIEW Features

All Controls and Indicators............................................................................................5- All VIs and Functions ....................................................................................................5- VIs ...................................................................................................................5- Functions .........................................................................................................5- Data Types .....................................................................................................................5- Dynamic Data Type.........................................................................................5- When to Use Other LabVIEW Features ........................................................................5-

Appendix A

Technical Support and Professional Services

Glossary

Index

About This Manual

Getting Started with LabVIEW x ni.com

monospace bold Bold text in this font denotes the messages and responses that the computer automatically prints to the screen. This font also emphasizes lines of code that are different from the other examples.

Platform Text in this font denotes a specific platform and indicates that the text following it applies only to that platform.

right-click (Mac OS) Press -click to perform the same action as a right-click.

Related Documentation

The following documents contain information that you may find helpful as you read this manual:

  • LabVIEW Release Notes —Use these release notes to install and uninstall LabVIEW. The release notes also describe the system requirements for the LabVIEW software, including the LabVIEW Application Builder.
  • LabVIEW Help —Use the LabVIEW Help to access information about LabVIEW programming concepts, step-by-step instructions for using LabVIEW, and reference information about LabVIEW VIs, functions, palettes, menus, tools, properties, methods, events, dialog boxes, and so on. The LabVIEW Help also lists the LabVIEW documentation resources available from National Instruments. Access the LabVIEW Help by selecting Help»Search the LabVIEW Help.
  • LabVIEW Quick Reference Card —Use this card as a reference for information about help resources, keyboard shortcuts, data type terminals, and tools for editing, execution, and debugging.

© National Instruments Corporation 1-1 Getting Started with LabVIEW

Getting Started with LabVIEW

Virtual Instruments

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.

Building a Virtual Instrument

In the following exercises, you will build a VI that generates a signal and displays that signal in a graph. After you complete the exercises, the front panel of the VI will look similar to the front panel in Figure 1-1.

You can complete the exercises in this chapter in approximately 40 minutes.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

© National Instruments Corporation 1-3 Getting Started with LabVIEW

Figure 1-2. Getting Started Window

The Getting Started window disappears when you open an existing file or create a new file. The Getting Started window reappears when you close all open front panels and block diagrams. You also can display the window from the front panel or block diagram by selecting View»Getting Started Window.

Opening a New VI from a Template

LabVIEW provides built-in template VIs that include the subVIs, 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.

  1. Launch LabVIEW.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

Getting Started with LabVIEW 1-4 ni.com

  1. In the Getting Started window, click the New or VI from Template link to display the New dialog box.
  2. From the Create New list, select VI»From Template»Tutorial (Getting Started)»Generate and Display. This template VI generates and displays a signal. A preview and a brief description of the template VI appear in the Description section. Figure 1-3 shows the New dialog box and the preview of the Generate and Display template VI.

Figure 1-3. New Dialog Box

  1. Click the OK button to create a VI from the template. You also can double-click the name of the template VI in the Create New list to create a VI from a template.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

Getting Started with LabVIEW 1-6 ni.com

  1. If you are a new LabVIEW user, the Controls palette opens with the Express subpalette visible by default. If you do not see the Express subpalette, click Express on the Controls palette to display the Express subpalette.

Figure 1-4. Controls Palette

  1. Move the cursor over the icons on the Express subpalette to locate the Numeric Controls palette. When you move the cursor over icons on the Controls palette, the name of the subpalette, control, or indicator appears in a tip strip below the icon.
  2. Click the Numeric Controls icon to display the Numeric Controls palette.
  3. Click the knob control on the Numeric Controls palette to attach the control to the cursor, then place the knob on the 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.
  4. Select File»Save As and save the VI as Acquiring a Signal.vi in an easily accessible location.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

© National Instruments Corporation 1-7 Getting Started with LabVIEW

Changing a Signal Type

The block diagram has a blue icon labeled Simulate Signal. This icon represents the Simulate Signal Express VI. The Simulate Signal Express VI simulates a sine wave by default.

Complete the following steps to change this signal to a sawtooth wave.

  1. Display the block diagram by pressing the <Ctrl-E> keys or by clicking the block diagram. Locate the Simulate Signal Express VI, shown at left. 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 that you specify.
  2. Right-click the Simulate Signal Express VI and select Properties from the shortcut menu to display the Configure Simulate Signal dialog box. (Mac OS) Press -click to perform the same action as right-click. You also can double-click the Express VI to display the Configure Simulate Signal dialog box. If you wire data to an Express VI and run it, the Express VI displays real data in the configuration dialog box. If you close and reopen the Express VI, the VI displays sample data in the configuration dialog box until you run the VI again.
  3. Select Sawtooth from the Signal type pull-down menu. The waveform on the graph in the Result Preview section changes to a sawtooth wave. The Configure Simulate Signal dialog box should appear similar to Figure 1-5.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

© National Instruments Corporation 1-9 Getting Started with LabVIEW

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.

  1. On the block diagram, move the cursor over the Knob terminal, shown at left. The cursor becomes an arrow, or the Positioning tool, shown at left. Use the Positioning tool to select, position, and resize objects.
  2. 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, shown at left. The terminals inside the loop are representations of front panel controls and indicators. Terminals are entry and exit ports that exchange information between the front panel and block diagram.
  3. Deselect the Knob terminal by clicking a blank space on the block diagram. If you want to use a different tool with an object, you must deselect the object to switch the tool.
  4. Move the cursor over the arrow on the Knob terminal, shown at left. The cursor becomes a wire spool, or the Wiring tool, shown at left. Use the Wiring tool to wire objects together on the block diagram.
  5. 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, shown at left, to wire the two objects together. A wire appears and connects the two objects. Data flows along this wire from the Knob terminal to the Express VI.
  6. Select File»Save to save the VI.

Chapter 1 Getting Started with LabVIEW Virtual Instruments

Getting Started with LabVIEW 1-10 ni.com

Running a VI

Running a VI executes the solution.

Complete the following steps to run the Acquiring a Signal VI.

  1. Display the front panel by pressing the <Ctrl-E> keys or by clicking the front panel.
  2. Click the Run button or press the <Ctrl-R> keys to run the VI.
  3. Move the cursor over the knob. The cursor becomes a hand, or the Operating tool, shown at left. Use the Operating tool to change the value of a control.
  4. 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. As you change the amplitude, the Operating tool displays a tip strip that indicates the numeric value of the knob. The y-axis on the graph scales automatically to account for the change in amplitude. To indicate that the VI is running, the Run button changes to a darkened arrow, shown at left. You can change the value of most controls while a VI runs, but you cannot edit the VI in other ways while the VI runs.
  5. Click the STOP button, shown at left, to stop the VI. The STOP button stops the VI after the VI completes the current iteration. The Abort Execution button, shown at left, stops the VI immediately, 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 by not resetting or releasing them properly. Design the VIs you create with a stop button to avoid this problem.