Vous êtes sur la page 1sur 6

Hands-On Introduction to

LabVIEW

for Scientists and Engineers


Second Edition
John Essick
Reed College
New York Oxford
OXFORD UNIVERSITY PRESS
vii
Contents
Preface xiii
1. THE WHILE LOOP AND WAVEFORM CHART 1
1.1 LabVIEW Programming Environment 1
1.2 Sine-Wave Plot using a While Loop and Waveform Chart 2
1.3 Block Diagram Editing 3
1.4 LabVIEW Help Window 20
1.5 Front Panel Editing 22
1.6 Pop-Up Menu 27
1.7 Finishing the Program 30
1.8 Program Execution 31
1.9 Program Improvements 33
1.10 Date-Type Representations 43
1.11 Automatic Creation Feature 46
1.12 Program Storage 48
Do It Yourself 50
Problems 51
2. THE FOR LOOP AND WAVEFORM GRAPH 56
2.1 For Loop Basics 56
2.2 Sine-Wave Plot using a For Loop and Waveform Graph 57
2.3 Waveform Graph 58
2.4 Owned and Free Labels 59
2.5 Creation of Sine Wave using a For Loop 60
2.6 Cloning Block-Diagram Icons 63
2.7 Auto-Indexing Feature 65
2.8 Running the VI 68
2.9 x-Axis Calibration of the Waveform Graph 69
2.10 Sine-Wave Plot using a While Loop and Waveform Graph 75
2.11 Array Indicators and the Probe Watch Window 79
Do It Yourself 90
Problems 92
viii
Contents
3. THE MATHSCRIPT NODE AND XY GRAPH 99
3.1 MathScript Node Basics 99
3.2 Quick MathScript Node Example: Sine-Wave Plot 102
3.3 Debugging with Error List 109
3.4 Waveform Simulator using a MathScript Node and XY Graph 111
3.5 Creating an xy Cluster 115
3.6 Running the VI 116
3.7 MathScript Interactive Window 117
3.8 Adding Shape Options to Waveform Simulator 121
3.9 The Enumerated Type Control 122
3.10 Finishing the Block Diagram 124
3.11 Running the VI 128
3.12 Control and Indicator Clusters 129
3.13 Creating an Icon using the Icon Editor 136
3.14 Icon Design 137
3.15 Connector Assignment 142
Do It Yourself 146
Problems 148
4. DATA ACQUISITION USING DAQ ASSISTANT 152
4.1 Data Acquisition VIs 152
4.2 Data Acquisition Hardware 153
4.3 Analog Input Modes 155
4.4 Range and Resolution 157
4.5 Sampling Frequency and the Aliasing Efect 158
4.6 Measurement & Automation Explorer (MAX) 160
4.7 Simple Analog Input Operation on a DC Voltage 164
4.8 Digital Oscilloscope 175
4.9 Analog Output 184
4.10 DC Voltage Source 185
4.11 Software-Timed Sine-Wave Generator 192
4.12 Hardware-Timed Waveform Generator 194
4.13 Placing a Custom-Made VI on a Block Diagram 197
4.14 Completing and Executing Waveform Generator (Express) 199
4.15 Modied Waveform Generator 201
Do It Yourself 203
Problems 204
ix
CONTENTS
5. DATA FILES AND CHARACTER STRINGS 211
5.1 ASCII Text and Binary Data Files 211
5.2 Storing Data in a Spreadsheet-Formatted File 213
5.3 Storing a One-Dimensional Data Array 214
5.4 Transpose Option 217
5.5 Storing a Two-Dimensional Data Array 220
5.6 Controlling the Format of Stored Data 224
5.7 The Path Constant and Platform Portability 226
5.8 Fundamental File I/O VIs 227
5.9 Adding Text Labels to a Spreadsheet File 233
5.10 Blackslash Codes 237
Do It Yourself 239
Problems 242
6. SHIFT REGISTERS 252
6.1 Shift Register Basics 252
6.2 Quick Shift Register Example: Integer Sum 255
6.3 Numerical Integration and Diferentiation using Shift Registers 258
6.4 Power Function Simulator VI 258
6.5 Numerical Integration via the Trapezoidal Rule 264
6.6 Trapezoidal Rule VI using Single Shift Register 267
6.7 Convergence Property of the Trapezoidal Rule 275
6.8 Numerical Diferentiation using a Multiple Shift Registers 278
6.9 Modularity and Automatic SubVI Creation 284
Do It Yourself 289
Problems 289
7. THE CASE STRUCTURE 296
7.1 Case Structure Basics 296
7.2 Quick Case Structure Example: Runtime Options using Property Nodes 299
7.3 Numerical Integration using Case Structures 310
7.4 Numerical Integration via Simpsons Rule 310
7.5 Parity Determiner using a Boolean Case Structure 313
7.6 Summation of Partial Sums using a Numeric Case Structure 318
7.7 Trapezoidal Rule Contribution using a Boolean Case Structure 321
7.8 Top-Level Simpsons Rule VI 323
7.9 Comparison of the Trapezoidal Rule and Simpsons Rule 326
Do It Yourself 329
Problems 330
x
Contents
8. DATA DEPENDENCY AND THE SEQUENCE STRUCTURE 338
8.1 Data Dependency and Sequence Structure Basics 338
8.2 Event Timer using a Sequence Structure 342
8.3 Event Timer using Data Dependency 349
8.4 Highlight Execution 352
Do It Yourself 354
Problems 355
9. ANALYSIS VISCURVE FITTING 364
9.1 Thermistor Resistance-Temperature Data File 364
9.2 Temperature Measurement using Thermistors 367
9.3 The Linear Least-Squares Method 370
9.4 Inputting Data to a VI using a Front-Panel Control 371
9.5 Inputting Data to a VI by Reading from a Disk File 376
9.6 Slicing Up a Multi-Dimensional Array 379
9.7 Curve Fitting using the Linear Least-Squares Method 385
9.8 Residual Plot 391
Do It Yourself 394
Problems 397
10. ANALYSIS VISFAST FOURIER TRANSFORM 405
10.1 The Fourier Transform 405
10.2 Discrete Sampling and the Nyquist Frequency 406
10.3 The Discrete Fourier Transform 407
10.4 The Fast Fourier Transform 408
10.5 Frequency Calculator VI 409
10.6 FFT of Sinusoids 412
10.7 Applying the FFT to Various Sinusoidal Inputs 414
10.8 Magnitude of the Complex-Amplitude 417
10.9 Observing Leakage 421
10.10 Analytic Description of Leakage 427
10.11 Description of Leakage Using the Convolution Theorem 430
10.12 Windowing 434
10.13 Estimating Frequency and Amplitude 440
10.14 Aliasing 443
Do It Yourself 444
Problems 445
xi
CONTENTS
11. DATA ACQUISITION AND GENERATION USING DAQMX VIS 451
11.1 DAQmx VIs 451
11.2 Simple Analog Input Operation on a DC Voltage 453
11.3 Digital Oscilloscope 459
11.4 Express VI Automatic Code Generation 466
11.5 Limitation of Express VIs 467
11.6 Improving Digital Oscilloscope using State Machine Architecture 469
11.7 Analog Output Operations 480
11.8 Waveform Generator 481
Do It Yourself 485
Problems 485
12. PID TEMPERATURE CONTROL PROJECT 491
12.1 Voltage-Controlled Bi-Directional Current Driver for
Thermoelectric Device 491
12.2 PID Temperature Control Algorithm 492
12.3 PID Temperature Control System 495
13. CONTROL OF STAND-ALONE INSTRUMENTS 498
13.1 Instrument Control using VISA VIs 498
13.2 The VISA Session 499
13.3 The IEEE 488.2 Standard 503
13.4 Common Commands 503
13.5 Status Reporting 504
13.6 Device-Specic Commands 508
13.7 Specic Hardware used in this Chapter 509
13.8 Measurement & Automation Explorer (MAX) 511
13.9 Simple VISA-Based Query Operation 518
13.10 Message Termination 522
13.11 Getting and Setting Communication Properties using a Property Node 523
13.12 Performing a Measurement over the Interface Bus 527
13.13 Synchronization Methods 532
13.14 Measurement VI Based on the Serial Poll Method 538
13.15 Measurement VI Based on the Service Request Method 545
13.16 Creating an Instrument Driver 551
13.17 Using the Instrument Driver to Write an Application Program 565
Do It Yourself 571
Problems 572
APPENDIX I: CONSTRUCTION OF TEMPERATURE CONTROL SYSTEM 575
APPENDIX II: PROGRAM CROSS REFERENCE TABLE 583

Vous aimerez peut-être aussi