Professional Documents
Culture Documents
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
FM.indd 1
6/22/06 9:43:57 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
blind folio : ii
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.
LabVIEW Graphical Programming, Fourth Edition
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.
Sponsoring Editor
Wendy Rinaldi
Copy Editor
Patti Scott
Editorial Supervisor
Jody McKenzie
Proofreader
Prachi Ghildiyal
Project Manager
Samik Roy Chowdhury
(Sam)
Indexer
WordCo Indexing
Services, Inc.
Composition
International Typesetting
and Composition
Illustration
International Typesetting
and Composition
Art Director, Cover
Margaret Webster-Shapiro
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.
FM.indd 2
6/22/06 9:43:57 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Contents
Preface
........................................................
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xv
Chapter 1 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
4
7
8
9
9
11
12
12
15
15
16
18
19
19
37
37
38
xi
22
23
24
25
26
26
28
29
29
31
32
32
34
iii
FM.indd 3
6/22/06 9:43:57 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
iv
FM.indd 4
Contents
LabVIEW under the Hood . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The parts of a VI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How VIs are compiled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multitasking, multithreaded LabVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The LabVIEW Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Front panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Property nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Block diagram
.................................................
SubVIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Icons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Polymorphic VIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Typedefs
.....................................................
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
See what the subVIs are up to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Peeking at data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
One step at a time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Execution highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setting breakpoints
.............................................
Suspend when called . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Calling Other Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CINs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dynamic link libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming by Plagiarizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
40
41
41
43
44
45
45
48
48
49
50
50
50
52
53
54
54
55
55
57
57
58
58
58
59
59
60
61
Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Dependency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Adding Common Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
While LOOPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
For Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Shift registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Uninitialized shift registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Globals
........................................................
Global and local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Built-in global variablesand their hazards . . . . . . . . . . . . . . . . . . . . . . . . . . .
Local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Notify and Filter events
..........................................
Mechanical actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dynamic events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Design Patterns
.................................................
Initialize and then loop
..........................................
Independent parallel loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Client-server
..................................................
Client-server (with autonomous VIs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
State machines
................................................
Queued message handler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Event-driven applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
62
63
64
65
66
67
69
71
71
73
75
81
81
85
85
87
87
89
90
92
94
98
100
102
6/22/06 9:43:58 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Contents
FM.indd 5
103
Numeric Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Building strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parsing strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dealing with unprintables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Spreadsheets, strings, and arrays
.................................
Arrays
.........................................................
Initializing arrays
...............................................
Array memory usage and performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conversion and coercion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intricate conversions and type casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Flatten To String (. . . Do what?) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Enumerated types (enums) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Get Carried Away Department . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
104
105
106
107
110
110
114
117
119
122
125
127
128
129
132
133
134
Chapter 5 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
137
137
138
139
140
141
143
145
146
147
149
Chapter 6 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
151
Polling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Occurrences
....................................................
Notifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Semaphores
....................................................
Me and You, Rendezvous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
152
153
155
158
160
161
165
Chapter 7 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
167
Accessing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reading Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Formatting to Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Binary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing binary files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reading binary files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing Datalog Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reading Datalog Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Datalog file utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
167
169
170
172
175
176
178
179
181
183
183
6/22/06 9:43:58 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
vi
Contents
185
186
186
187
189
191
192
193
196
197
197
198
200
201
202
203
204
207
213
214
214
216
217
218
218
218
221
223
224
227
229
Chapter 9 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
231
VI Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Control Descriptions
..............................................
Custom Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Documenting the Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VI History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other Ways to Document
..........................................
Printing LabVIEW Panels and Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Putting LabVIEW screen images into other documents . . . . . . . . . . . . . . . . . .
Writing Formal Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Document outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connector pane picture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VI description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terminal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Distributing Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
231
232
233
234
234
235
235
236
238
238
239
239
240
241
241
Chapter 10
FM.indd 6
243
243
245
245
249
250
6/22/06 9:43:59 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Contents
vii
Establish Communications
.........................................
Hardware and wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Protocols and basic message passing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
251
252
254
256
Chapter 11
257
259
260
261
265
266
267
268
270
270
271
272
273
274
Chapter 12
275
Origins of Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transducers and sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Actuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Categories of signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Grounding and shielding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why use amplifiers or other signal conditioning? . . . . . . . . . . . . . . . . . . . . . . .
Choosing the right I/O subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Network everything! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
275
276
278
279
284
284
291
299
303
304
Chapter 13
Sampling Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
305
Sampling Theorem
...............................................
Filtering and Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About ADCs, DACs, and Multiplexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Digital-to-analog converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Digital codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Triggering and Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Little Noise Can Be a Good Thing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Throughput
.....................................................
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
305
307
309
314
315
316
317
319
321
Chapter 14
FM.indd 7
323
325
326
337
343
343
344
350
350
351
352
6/22/06 9:43:59 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
viii
Contents
Configuration compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Saving and recalling configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Low-Speed Data Acquisition Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Medium-Speed Acquisition and Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 15
LabVIEW RT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
377
377
379
382
383
388
389
391
393
395
395
398
399
Chapter 16
LabVIEW FPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
401
What Is an FPGA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LabVIEW for FPGAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RIO hardware platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Plug-in cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CompactRIO
..................................................
Timing and synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compact Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronous execution and the enable chain . . . . . . . . . . . . . . . . . . . . . . . . .
Clocked execution and the single-cycle Timed Loop . . . . . . . . . . . . . . . . . . . .
Parallelism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pipelining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
401
403
403
403
404
405
405
406
406
408
408
411
413
413
414
415
Chapter 17
FM.indd 8
362
365
370
373
375
LabVIEW Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
417
Introduction
...................................................
History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LabVIEW Embedded Development Module . . . . . . . . . . . . . . . . . . . . . . . . . . .
The technology: Whats happening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Running LabVIEW Embedded on a new target . . . . . . . . . . . . . . . . . . . . . . . .
Porting the LabVIEW runtime library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Incorporating the C toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Embedded Project Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LEP plug-in VIs
................................................
Target_OnSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other plug-in VIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Incorporating I/O srivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LabVIEW Embedded programming best practices . . . . . . . . . . . . . . . . . . . . .
Interrupt driven programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LabVIEW Embedded targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
417
417
419
419
421
422
423
424
425
426
426
429
431
434
435
6/22/06 9:44:00 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Contents
Chapter 18
437
438
438
444
447
449
455
461
463
463
469
473
474
475
476
477
479
482
484
485
486
486
487
489
490
492
493
499
499
502
505
506
508
511
512
Chapter 19
FM.indd 9
ix
Physics Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
513
Special Hardware
................................................
Signal conditioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CAMAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other I/O hardware
.............................................
Field and Plasma Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step-and-measure experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Plasma potential experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Handling Fast Pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transient digitizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Digital storage oscilloscopes (DSOs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timing and triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Capturing many pulses
..........................................
Recovering signals from synchronous experiments . . . . . . . . . . . . . . . . . . . . .
Handling Huge Data Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reducing the amount of data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optimizing VIs for memory usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
514
514
518
518
520
520
527
533
533
536
537
539
543
546
546
547
553
6/22/06 9:44:00 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Contents
555
Graphing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Displaying waveform and cartesian data . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bivariate data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multivariate data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3D Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intensity Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Image Acquisition and Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
System requirements for imaging
..................................
Using IMAQ Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IMAQ components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DAQ for sound I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound I/O functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
556
558
563
565
570
571
572
574
577
577
586
586
587
587
588
588
589
Index
FM.indd 10
....................................................
591
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
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 application builder for stand-alone applications. The LabVIEW development
environment runs on Apple Macintosh computers and IBM PC compatibles 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 instrument (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
indispensablea flexible, time-saving package without all the frustrating 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 signalconditioning problems? In this book, we describe practical problemsolving techniques that arent in the manual or in the introductory
classesmethods 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 manuals or other introductory books, nor is it a substitute for a course in
xi
FM.indd 11
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
xii
Preface
FM.indd 12
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Preface
xiii
simple: more than half the LabVIEW questions that coworkers ask us
turn out to be hardware- and signal-related. Information in this chapter is vital and will be useful no matter what software you may use for
measurement and control. Chapter 14, Writing a Data Acquisition Program, contains a practical view of data acquisition (DAQ) applications.
Some topics may seem at first to be presented backwardbut 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 performance by paying attention to code optimization, scheduling, and
communications.
When software-timed real-time applications wont 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 control applications with closed loop rates in the tens of megahertz. Chapter 16, LabVIEW FPGA, gives a solid introduction to programming
FPGAs with LabVIEW.
Embedded computer systems are all around usin our cars, VCRs,
appliances, test equipment, and a thousand other applications. But until
now, LabVIEW has not been a viable development system for those miniaturized 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 control and all types of measurement and control situations. Well look at
human-machine interfaces, sequential and continuous control, trending, alarm handling, and interfacing to industrial controllers, particularly 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, measuring fast pulses with transient recorders, and handling very large
data sets. This last topic, in particular, is of interest to almost all users
FM.indd 13
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
xiv
Preface
FM.indd 14
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
Acknowledgments
Gary W. Johnson:
To my wife, Katharine
Richard Jennings:
To my Lord and Savior, Jesus Christ
xv
FM.indd 15
6/22/06 9:44:01 AM
LabVIEW / LabVIEW Graphical Programming / Jennings & Johnson / 45146-3/ Front Matter
blind folio xvi
FM.indd 16
6/22/06 9:44:03 AM