Table of Contents
| 1 | What in the world is LabVIEW? | 3 |
| 2 | Virtual instrumentation : hooking your computer up to the real world | 21 |
| 3 | The LabVIEW environment | 41 |
| 4 | LabVIEW foundations | 101 |
| 5 | Yet more foundations | 147 |
| 6 | Controlling program execution with structures | 185 |
| 7 | LabVIEW's composite data : arrays and clusters | 245 |
| 8 | LabVIEW's exciting visual displays : charts and graphs | 301 |
| 9 | Exploring strings and file I/O | 379 |
| 10 | Signal measurement and generation : data acquisition | 419 |
| 11 | Data acquisition in LabVIEW | 465 |
| 12 | Instrument control in LabVIEW | 523 |
| 13 | Advanced LabVIEW structures and functions | 553 |
| 14 | Advanced LabVIEW data concepts | 673 |
| 15 | Advanced LabVIEW features | 721 |
| 16 | Connectivity in LabVIEW | 799 |
| 17 | The art of LabVIEW programming | 853 |
Forewords & Introductions
Preface
LabVIEW, or Laboratory Virtual Instrument Engineering Workbench, is a graphical programming language that has been widely adopted throughout industry, academia, and research labs as the standard for data acquisition and instrument control software. LabVIEW is a powerful and flexible instrumentation and analysis software system that is multiplatform (predating Java, which makes the same claim)you can run LabVIEW on Windows, MacOS, Linux, Solaris, and HP-UX. Personal computers are much more flexible than standard instruments, and creating your own LabVIEW program, or virtual instrument (VI), is simple. LabVIEW's intuitive user interface makes writing and using programs exciting and fun!
LabVIEW departs from the sequential nature of traditional programming languages and features an easy-to-use graphical programming environment, including all of the tools necessary for data acquisition (DAQ), data analysis, and presentation of results. With its graphical programming language, called "G," you program using a graphical block diagram that compiles into machine code. Ideal for a countless number of science and engineering applications, LabVIEW helps you solve many types of problems in only a fraction of the time and hassle it would take to write "conventional" code.
Beyond the Lab
LabVIEW has found its way into such a broad spectrum of virtual instrumentation applications that it is hard to know where to begin. As its name implies, it began in the laboratory and still remains very popular in many kinds of laboratories--from major research and development laboratories around the world (such as Lawrence Livermore, Argonne, Batelle, Sandia, JetPropulsion Laboratory, White Sands, and Oak Ridge in the United States and CERN in Europe), to R&D laboratories in many industries, and to teaching laboratories in universities all over the world, especially in the disciplines of electrical and mechanical engineering and physics.
The spread of LabVIEW beyond the laboratory has gone in many directionsup (aboard the space shuttle), down (aboard U.S. Navy submarines), and around the world (from oil wells in the North Sea to factories in New Zealand). And with the latest Internet capabilities, LabVIEW applications are being deployed not only physically in many places but virtually across cyberspace. More and more people are creating web-based control or monitoring of their LabVIEW applications to allow remote access and instant information about what's happening in their lab. Virtual instrumentation systems are known for their low cost, both in hardware and development time, and their great flexibility. Is it any wonder that they are so popular?
The Expanding World of Virtual Instrumentation
Perhaps the best way to describe the expansion (or perhaps explosion) of LabVIEW applications is to generalize it. There are niches in many industries where measurements of some kind are required--most often of temperature, whether it be in an oven, a refrigerator, a greenhouse, a clean room, or a vat of soup. Beyond temperature, users measure pressure, force, displacement, strain, pH, and so on, ad infinitum. Personal computers are used virtually everywhere. LabVIEW is the catalyst that links the PC with measuring things, not only because it makes it easy, but also because it brings along the ability to analyze what you have measured and display it and communicate it halfway around the world if you so choose.
After measuring and analyzing something, the next logical step often is to change (control) something based upon the results. For example, measure temperature and then turn on either a furnace or a chiller. Again, LabVIEW makes this easy to do; monitoring and control have become LabVIEW strengths. Sometimes it is direct monitoring and control, or it may be through communicating with a programmable logic controller (PLC) in what is commonly called supervisory control and data acquisition (SCADA).
The Results
You will find descriptions of LabVIEW applications interspersed throughout this book. They are written by users in a very brief style to give you the essence of the application and are chosen from industry segments in which LabVIEW tends to be very popular--automated electronics testing, semiconductor manufacturing, medical instrumentation, automotive testing, and industrial automation applications. Of the multitude of successful LabVIEW applications, these are particularly interesting current examples of virtual instrumentation at its finest!
A few of LabVIEW's many uses include:
- Simulating heart activity
- Controlling an ice cream-making process
- Detecting hydrogen gas leaks on the space shuttle
- Monitoring feeding patterns of baby ostriches
- Modeling power systems to analyze power quality
- Measuring physical effects of exercise in lab rats
- Controlling motion of servo and stepper motors
- Testing circuit boards in computers and other electronic devices
- Simulating motion in a virtual reality system
- Allo over the Web of a helium-filled blimp
Objectives of This Book
LabVIEW for Everyone will help you get LabVIEW up and running quickly and easily and will start you down the road to becoming an expert programmer. The book offers additional examples and activities to demonstrate techniques, identifies other sources of information about LabVIEW, and features descriptions of cool LabVIEW applications. You are invited to open, inspect, use, and modify any of the programs on the accompanying CD-ROM. The CD-ROM includes the 30-day evaluation version of LabVIEW, which allows you to do just about everything the commercial version does.
This book expects you to have basic knowledge of your computer's operating system. If you don't have much computer experience, you may want to spend a little time with your operating system manual and familiarize yourself with your computer. For example, you should know how to access menus, open and save files, make backup disks, and use a mouse.
After reading this book and working through the exercises, you should be able to do the following, and much more, with the greatest of ease:
- Write LabVIEW programs, called virtual instruments, or VIs
- Employ various debugging techniques
- Manipulate both built-in LabVIEW functions and library VIs
- Create and save your own VIs so that you can use them as subVIs, or subroutines
- Design custom graphical user interfaces (GUIs)
- Save your data in a file and display it on a graph or chart
- Build applications that use General Purpose Interface Bus (GPIB) or serial instruments
- Create applications that use plug-in DAQ boards
analysis functions to process your data - Optimize the speed and performance of your LabVIEW programs
- Employ advanced techniques such as globals, locals, and attribute nodes
- Publish your data over the Internet or on the Web, using LabVIEW's features such as HTML printing or DataSocket
- Use LabVIEW to create your instrumentation applications
LabVIEW for Everyone helps you get started quickly with LabVIEW to develop your instrumentation and analysis applications. The book is divided into two main sections: Fundamentals and Advanced Topics.
The Fundamentals section contains nine chapters and teaches you the fundamentals of G programming in LabVIEW. The Advanced Topics section contains six chapters that further develop your skills and introduce helpful techniques and optimizing strategies. We suggest that you work through the beginning section to master the basics; then, if you're short on time, skip around to what you really want to learn in the advanced section.
In both sections, chapters have a special structure to facilitate learning.
- Overview, goals, and key terms describe the main ideas covered in that chapter.
- The main sections are a discussion of the featured topics.
- Activities reinforce the information presented in the discussion.
- Wrap It Up! summarizes important concepts and skills taught in the chapter.
- Additional activities in many chapters give you more practice with the new material.
Fundamentals
Chapter 1 describes LabVIEW and introduces you to some of LabVIEW's features and uses.
In Chapter 2, you will get an overview of vir acquisition, instrument control, and data analysis are performed with LabVIEW. You will also learn about LabVIEW's history and a couple of real-world applications.
In Chapter 3, you will get acquainted with the LabVIEW environment, including the essential parts of a virtual instrument (or VI), the Help window, menus, tools, palettes, and subVIs.
In Chapters 4 and 5, you will become familiar with the basics of G programming in LabVIEW--using controls and indicators (such as numerics, Booleans, and strings); wiring, creating, editing, debugging, and saving VIs; creating subVIs; and documenting your work. You will also begin to understand why G is considered a dataflow programming language.
Chapter 6 describes the basic G programming structures in LabVIEW: while loops, for loops, shift registers, case structures, sequence structures, and formula nodes. It also teaches you how to introduce timing into your programs.
In Chapter 7, you will learn how to use two important data structures--arrays and clusters--in your programs. You will also explore LabVIEW's built-in functions for manipulating arrays and clusters.
Chapter 8 details the variety of charts and graphs available in LabVIEW and teaches you how to use them for animated and informative data presentation. It also introduces the waveform data type.
Chapter 9 discusses string data types, string functions, and tables. It also talks a little about how to save data in and read data from a file, using LabVIEW's easy File I/O VIs.
Advanced Topics
Chapter 10 teaches you more about data acquisition, GPIB, and serial communication. You will learn a bit of theory and some hardware considerations, and you will find a valuable guide to many common acronyms used in instrumentation. Chapter 10 also discusses software setup for data acquisition hardware.
Chapter 11 discusses a few basics on how to use LabVIEW to acquire data using plug-in DAQ boards and presents a brief overview on communicating with other instruments using GPIB and serial protocols.
Chapter 12 covers some invaluable advanced features such as local and global variables, property nodes, ActiveX, DLLs, data type conversions, and much more.
Chapter 13 shows you how to configure VI behavior and appearance using VI Setup options and how to access front panel controls using the keyboard.
Chapter 14 covers connectivity in LabVIEW and deals with exciting topics such as publishing to the Web from LabVIEW, data sharing with DataSocket, and communication with protocols such as TCP/IP. It also introduces the VI Server.
Chapter 15 describes some good programming techniques that you can use to make your programs run faster, use less memory, port more easily to other platforms, and behave more efficiently overall.
In Chapter 16, you will learn good LabVIEW style and some new tips, such as how to add a customized look to your applications by importing pictures and using the Control Editor.
You will find a glossary, index, and an appendix at the end of the book.
Appendix A lists some resources that can help you with LabVIEW. It also describes add-on toolkits available to enhance LabVIEW's functionality.
What's New in This Second Edition
LabVIEW for Everyone was the first book published aimed at the beginner LabVIEW user; since then, Prentice-Hall and other publishers have produced over a dozen LabVIEW books on specific topics. This new second edition of LabVIEW for Everyone has been completely updated for LabVIEW 6i. Among the changes from the first edition (which was published at the time of LabVIEW 4.0) are:
- Completely revamped and updated screenshots, examples, and activities updated for LabVIEW 6i's new interface "look and feel"
- Updated text covering the new LabVIEW 6i features
- Updated section on data acquisition and instrument control, featuring the NI Measurement and Automation Explorer (MAX)
- A new chapter on LabVIEW connectivity that has extended coverage of more Internet topics, such as DataSocket, the VI Server, and publishing to the Web
- Discussion of new features such as the waveform data type, 3D graphs, report generation, and more
LabVIEW Installation Instructions
If you have the full version of LabVIEW and need instructions on how to install it, please see the release notes that came with your software. If you don't have LabVIEW yet, you can try out the evaluation version on the CD. The evaluation version expires 30 days after you install it.
In addition, you will need to access the Everyone directory from the CD-ROM in the back of this book. It contains the activities in this book and their solutions. You may want to copy the Everyone directory onto your PC so you can save your activity work there as well.
Minimum Specifications for LabVIEW and the Evaluation Software
The basic engine of the evaluation software is the same as the full version of LabVIEW, so the system requirements are also about the same.
Windows XP/2000/NT/Me/9X
- For Windows NT, use Windows NT 4.0 Service Pack 3 or later
- 32 MB RAM minimum, 6 recommended
- 65 MB disk space for minimal LabVIEW installation, 200 MB for full installation*
- Pentium processor or equivalent recommended
Mac OS
- Mac OS 7.6.1 or later
- 32 MB RAM minimum, 64 MB recommended
- 100 MB disk space for minimal LabVIEW installation, 225 MB for full installation*
- PowerPC processor
Linux
- Linux kernel 2.0.x or later
- Any Linux distribution with GNU C Library Version 2.0.5 or later (known as glibc2 or libc.so.6), including:
- RedHat Linux 5.0 or later
- SuSE Linux 6.0 or later
- SuSE Linux 5.3 with shlibs6-98.9.25-0 RPM installed
- Caldera OpenLinux 1.3 or later
- Debian Linux 2.0 or later
- 32 MB RAM minimum, 64 MB recommended
- 32 MB swap space storage
- 65 MB disk space for minimal LabVIEW installation, 150 MB for full installation*
- XWindows System server
- Pentium processor or equivalent recommended
Sun
- Solaris 2.5.1 or later
- 32 MB RAM minimum, 64 MB recommended
- 32 MB swap space storage
- 65 MB disk space for minimal LabVIEW installation, 150 MB for full installation*
- XWindows System server
- SPARC processor (Sun SPARCstations)
HP-UX
- HP-UX 10.20 or later
- 32 MB RAM minimum, 64 MB recommended
- 32 MB swap space storage
- 65 MB disk space for minimal LabVIEW installation, 150 MB for full installation*
- XWindows System server
store temporary files. Some of the temporary files are large, so we recommend that you have several megabytes of disk space available for this temporary directory. The default for the temporary directory is /tmp on Windows and Unix and inside the trash can on MacOS.Purchasing LabVIEW
If you would like information on how to purchase LabVIEW, contact National Instruments.