Lab View FM
Lab View FM
blind folio : i
Gary W. Johnson
Richard Jennings
McGraw-Hill
New York Chicago San Francisco Lisbon London
Madrid Mexico City Milan New Delhi San Juan
Seoul Singapore Sydney Toronto
McGraw-Hill books are available at special quantity discounts to use as premiums and
sales promotions, or for use in corporate training programs. For more information, please
write to the Director of Special Sales, Professional Publishing, McGraw-Hill, Two Penn
Plaza, New York, NY 10121-2298. Or contact your local bookstore.
Copyright © 2006 by The McGraw-Hill Companies. All rights reserved. Printed in the
United States of America. Except as permitted under the Copyright Act of 1976, no
part of this publication may be reproduced or distributed in any form or by any means,
or stored in a database or retrieval system, without the prior written permission of
publisher, with the exception that the program listings may be entered, stored, and
executed in a computer system, but they may not be reproduced for publication.
ISBN 0-07-145146-3
Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of
the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill does not
guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or
omissions or the results obtained from the use of such information.
Contents
Preface ........................................................ xi
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Chapter 1 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
LabVIEW and Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Virtual instruments: LabVIEW’s foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Why use LabVIEW? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
The Origin of LabVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Introduction ................................................... 9
A vision emerges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
All the world’s an instrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
A hard-core UNIX guy won over by the Macintosh . . . . . . . . . . . . . . . . . . . . . 12
Putting it all together with pictures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Favoring the underdog platform for system design . . . . . . . . . . . . . . . . . . . . . 15
Ramping up development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Stretching the limits of tools and machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Facing reality on estimated development times . . . . . . . . . . . . . . . . . . . . . . . . 18
Shipping the first version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Apple catches up with the potential offered by LabVIEW ................ 19
LabVIEW 2: A first-rate instrument control product becomes
a world-class programming system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
The port to Windows and Sun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LabVIEW 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
LabVIEW 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
LabVIEW branches to BridgeVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
LabVIEW 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
The LabVIEW RT branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
LabVIEW 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
LabVIEW 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
LabVIEW 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Crystal Ball Department . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
LabVIEW influences other software products . . . . . . . . . . . . . . . . . . . . . . . . . 32
LabVIEW Handles Big Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
iii
iv Contents
Contents v
vi Contents
Contents vii
viii Contents
Contents ix
x Contents
Preface
Twenty years have passed since the release of LabVIEW. During this
period, it has become the dominant programming language in the world
of instrumentation, data acquisition, and control. A product of National
Instruments Corporation (Austin, Texas), it is built upon a purely
graphical, general-purpose programming language, G, with extensive
libraries of functions, an integral compiler and debugger, and an appli-
cation builder for stand-alone applications. The LabVIEW development
environment runs on Apple Macintosh computers and IBM PC compat-
ibles with Linux or Microsoft Windows. Programs are portable among
the various development platforms. The concept of virtual instruments
(VIs), pioneered by LabVIEW, permits you to transform a real instru-
ment (such as a voltmeter) into another, software-based instrument
(such as a chart recorder), thus increasing the versatility of available
hardware. Control panels mimic real panels, right down to the switches
and lights. All programming is done via a block diagram, consisting of
icons and wires, that is directly compiled to executable code; there is no
underlying procedural language or menu-driven system.
Working with research instrumentation, we find LabVIEW
indispensable—a flexible, time-saving package without all the frustrat-
ing aspects of ordinary programming languages. The one thing LabVIEW
had been missing all these years was a useful application-oriented book.
The manuals are fine, once you know what you want to accomplish, and
the classes offered by National Instruments are highly recommended
if you are just starting out. But how do you get past that first blank
window? What are the methods for designing an efficient LabVIEW
application? What about interface hardware and real-world signal-
conditioning problems? In this book, we describe practical problem-
solving techniques that aren’t in the manual or in the introductory
classes—methods you learn only by experience. The principles and
techniques discussed in these pages are fundamental to the work of
a LabVIEW programmer. This is by no means a rewrite of the manu-
als or other introductory books, nor is it a substitute for a course in
xi
xii Preface
Preface xiii
simple: more than half the “LabVIEW” questions that coworkers ask us
turn out to be hardware- and signal-related. Information in this chap-
ter is vital and will be useful no matter what software you may use for
measurement and control. Chapter 14, “Writing a Data Acquisition Pro-
gram,” contains a practical view of data acquisition (DAQ) applications.
Some topics may seem at first to be presented backward—but for good
reasons. The first topic is data analysis. Why not talk about sampling
rates and throughput first? Because the only reason for doing data
acquisition is to collect data for analysis. If you are out of touch with the
data analysis needs, you will probably write the wrong data acquisition
program. Other topics in this chapter are sampling speed, throughput
optimization, and configuration management. We finish with some of
the real applications that you can use right out of the box.
LabVIEW RT brings the ease of graphical programming to the arcane
world of real-time system programming. In Chapter 15, “LabVIEW RT,”
we show you how LabVIEW RT works and how to achieve top per-
formance by paying attention to code optimization, scheduling, and
communications.
When software-timed real-time applications won’t fit the bill,
LabVIEW FPGA is the way to go. LabVIEW FPGA applications are not
constrained by processor or operating system overhead. With LabVIEW
FPGA you can write massively parallel hardware-timed digital con-
trol applications with closed loop rates in the tens of megahertz. Chap-
ter 16, “LabVIEW FPGA,” gives a solid introduction to programming
FPGAs with LabVIEW.
Embedded computer systems are all around us—in our cars, VCRs,
appliances, test equipment, and a thousand other applications. But until
now, LabVIEW has not been a viable development system for those min-
iaturized computers. Chapter 17, “LabVIEW Embedded,” introduces a
new version of LabVIEW capable of targeting any 32-bit microprocessor.
Chapter 18, “Process Control Applications,” covers industrial con-
trol and all types of measurement and control situations. We’ll look at
human-machine interfaces, sequential and continuous control, trend-
ing, alarm handling, and interfacing to industrial controllers, particu-
larly programmable logic controllers (PLCs).We frequently mention a
very useful add-on toolkit that you install on top of LabVIEW, called
the Datalogging and Supervisory Control Module (formerly available
as BridgeVIEW), which adds many important features for industrial
automation.
LabVIEW has a large following in physics research, so we wrote
Chapter 19, “Physics Applications.” Particular situations and solutions
in this chapter are electromagnetic field and plasma diagnostics, mea-
suring fast pulses with transient recorders, and handling very large
data sets. This last topic, in particular, is of interest to almost all users
xiv Preface
Acknowledgments
Gary W. Johnson:
To my wife, Katharine
Richard Jennings:
To my Lord and Savior, Jesus Christ
xv