Tektronix Oscilloscope Analysis,Connectivity Made EasyUnexpected Error User Manual

OSCILLOSCOPE
ANALYSIS AND
Includes Excel
CONNECTIVITY

, Visual Basic, MATLAB
MADE EASY

and LabVIEW

Examples
Copyright Tektronix Inc. All rights reserved. Licensed software products are owned by Tektronix or its suppliers and are protected by United States copyright laws and international treaty provisions. LabVIEW and LabWindows™/CVI are trademarks of National Instruments Corporation. Mathcad is a registered trademark of MathSoft, Inc. MATLAB is a registered trademark of The MathWorks, Inc. Microsoft and Excel are trademarks and Windows is a registered trademark of Microsoft Corporation.
Tektronix, Inc., P.O. Box 500, Beaverton, OR 97077
Tektronix and Tek are registered trademarks of Tektronix, Inc.
Software on the CD is provided AS IS with no warranties of any
Note:
kind, specifically excluding WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Tektronix, Inc. assumes no liability of any kind for your use of this software.
Table of Contents
PREFACE........................................................................................................................................XI
What This Book is About.................................................................................................................. xi
Who Should Read This Book........................................................................................................... xi
How This Book is Organized............................................................................................................ xi
Document Conventions....................................................................................................................xii
CHAPTER 1: CONNECTIVITY BUILDING BLOCKS ..................................................................... 1
Connectivity Made Easier ................................................................................................................. 1
Built-in Connectivity Features ........................................................................................................... 1
New Connectivity Building Blocks..................................................................................................... 3
TekVISAA Standard Way to Connect....................................................................................... 4
MATLAB’s Instrument Control Toolbox.......................................................................................... 9
PART 1: EXCEL AND VISUAL BASIC .......................................................................................... 11
CHAPTER 2: THE TEKEXCEL TOOLBAR................................................................................... 13
Introduction ..................................................................................................................................... 13
Toolbar Prerequisites.................................................................................................................. 13
Toolbar Features......................................................................................................................... 14
Adding the TekExcel Toolbar to Excel............................................................................................14
Connecting to Oscilloscopes........................................................................................................... 15
Saving and Restoring Scope Settings.............................................................................................16
Save Settings from the Scope.....................................................................................................17
Assign Stored Settings to the Scope...........................................................................................20
Capturing and Graphing Waveforms...............................................................................................21
Clearing the Active Sheet................................................................................................................24
Capturing and Graphing Measurements......................................................................................... 24
Capture Single Measurement(s)................................................................................................. 24
Capture and Graph Repeated Measurement(s).......................................................................... 27
Capturing Triggered Waveforms..................................................................................................... 31
Getting Help with the TekExcel Toolbar..........................................................................................34
TekExcel Toolbar Source Code...................................................................................................... 35
Chapter 2 Review ...........................................................................................................................35
CHAPTER 3: UNDERSTANDING THE TEKVISA ACTIVEX CONTROL ....................................37
Introduction ..................................................................................................................................... 37
Background Information.................................................................................................................. 37
Terminology .................................................................................................................................... 38
Automated Acquisition .................................................................................................................... 38
Native GPIB Commands and Queries ........................................................................................ 39
i
TekVISA ActiveX Control Methods, Properties, and Events .......................................................39
CHAPTER 4. A SIMPLE PROGRAM TO GET WAVEFORMS ......................................................41
Introduction .....................................................................................................................................41
GPIB Commands for Waveform Acquisition....................................................................................41
Waveform Data ...........................................................................................................................41
Waveform Preamble....................................................................................................................43
The TekVISA ActiveX Control and Waveform Acquisition...............................................................43
The GetWaveform Method..........................................................................................................43
Other Methods of Waveform Acquisition.....................................................................................43
Getting Started................................................................................................................................ 44
What You Need to Get Started....................................................................................................44
What You Will Do ........................................................................................................................45
What You Will Learn....................................................................................................................47
The Get Waveform Example in Excel VBA .....................................................................................48
Building the Form........................................................................................................................48
Getting Help ................................................................................................................................53
Changing Properties in the Properties Window...........................................................................54
Using the Object Browser (F2)....................................................................................................57
Coding the Event Procedures .....................................................................................................60
Running the GetWaveForm Program..........................................................................................69
Running the Program with the Jitter Example .................................................................................71
Using VB Instead of VBA ................................................................................................................74
Chapter 4 Review............................................................................................................................76
CHAPTER 5. A MORE COMPLEX FOUR-PART PROGRAM .......................................................77
Introduction .....................................................................................................................................77
What You Need to Get Started....................................................................................................77
What You Will Do ........................................................................................................................78
What You Will Learn....................................................................................................................80
The TekVISA Test Run Example in Excel VBA...............................................................................81
Building the Form........................................................................................................................81
Changing Properties in the Properties Window...........................................................................81
The Current Devices List Box......................................................................................................83
The Measurement Commands Frame.........................................................................................84
The Waveform Data Frame.........................................................................................................87
The Send GPIB Commands Frame ............................................................................................93
Running the TekVISA Test Run Program....................................................................................95
Using VB Instead of VBA ................................................................................................................97
Chapter 5 Review............................................................................................................................98
CHAPTER 6: A MEASUREMENT CHARTING EXAMPLE........................................................... 99
Introduction .....................................................................................................................................99
What You Need to Get Started....................................................................................................99
ii
What You Will Do...................................................................................................................... 100
What You Will Learn ................................................................................................................. 103
The Chart Measurements Example in Excel VBA.........................................................................104
Building the Form...................................................................................................................... 104
Changing Properties in the Properties Window ........................................................................104
Initialization ............................................................................................................................... 107
Choosing Measurements.......................................................................................................... 109
Displaying Results ....................................................................................................................116
Running the Chart Measurements Program .............................................................................120
Using VB Instead of VBA.............................................................................................................. 121
Chapter 6 Review .........................................................................................................................124
CHAPTER 7: A TRIGGERED WAVEFORM CAPTURE EXAMPLE........................................... 127
Introduction ................................................................................................................................... 127
Getting Started.............................................................................................................................. 127
What You Need to Get Started ................................................................................................. 127
What You Will Do...................................................................................................................... 128
What You Will Learn ................................................................................................................. 130
The Triggered Waveform Capture Example in VB........................................................................ 130
Building the Form...................................................................................................................... 130
Getting Help.............................................................................................................................. 141
Reviewing the Code.................................................................................................................. 143
Running the Triggered Waveform Capture Example ................................................................ 158
Using VBA Instead of VB.............................................................................................................. 162
Chapter 7 Review .........................................................................................................................163
PART 2: MATLAB AND LABWINDOWS/CVI AND LABVIEW................................................... 165
CHAPTER 8: LIVE UPDATES TO MATLAB USING ICT ...........................................................167
Introduction ................................................................................................................................... 167
What You Need to Get Started ................................................................................................. 167
What You Will Do...................................................................................................................... 168
What You Will Learn ................................................................................................................. 168
The Instrument Control Toolbox....................................................................................................168
Configuring VISA Resources .................................................................................................... 169
Communicating with VISA-GPIB Objects..................................................................................169
Using the Instrument Control ASCII Communication Tool ........................................................ 170
Cleaning up Instrument Objects during Debugging ..................................................................172
The Jitter Example with MATLAB ICT Functions.......................................................................... 173
Creating the jitter2 Function...................................................................................................... 174
Testing Automatic Waveform Acquisition.................................................................................. 182
Improved Jitter Example with a GUI Interface............................................................................... 184
Adding GUI Components to the Solution.................................................................................. 184
Performing an Interim Test........................................................................................................189
iii
Modifying Auto-Generated Functions........................................................................................189
Testing the Improved Solution...................................................................................................204
Chapter 8 Review..........................................................................................................................206
CHAPTER 9: LABWINDOWS/CVI AND LABVIEW ....................................................................207
Introduction ...................................................................................................................................207
Tektronix Plug-n-Play Drivers........................................................................................................207
Overview of LabWindows/CVI.......................................................................................................208
Using Tektronix Plug-n-Play Drivers with LabWindows/CVI..........................................................209
Loading the Driver.....................................................................................................................209
Building the Interface.................................................................................................................213
Getting Help ..............................................................................................................................216
Modifying Auto-Generated Functions........................................................................................217
Running Your Program..............................................................................................................226
Overview of LabVIEW ...................................................................................................................227
Using Tektronix Plug-n-Play Drivers with LabVIEW......................................................................228
Loading the Driver.....................................................................................................................228
Viewing Driver Functions...........................................................................................................230
Getting Help ..............................................................................................................................231
Creating a Quick Demo Program ..............................................................................................234
Running Your Program..............................................................................................................243
Using VISA Operations with LabVIEW..........................................................................................244
Creating a Timed Measurement Program.................................................................................244
Running Your Program..............................................................................................................252
Chapter 9 Review..........................................................................................................................253
APPENDIX A: COMMAND AND CONTROL REFERENCE.........................................................255
Introduction ...................................................................................................................................255
Native GPIB Commands and Queries...........................................................................................255
TekVISA Active X Control Methods, Properties, and Events ........................................................263
MATLAB Instrument Control Toolbox Functions ...........................................................................281
PnP Driver Functions ....................................................................................................................287
VISA Operations............................................................................................................................288
APPENDIX B: FAST LAN ACCESS TO YOUR OSCILLOSCOPE.............................................. 291
Introduction ...................................................................................................................................291
VXI-11 and LAN Connectivity for Oscilloscopes............................................................................291
Benefits of LAN Access.................................................................................................................292
Deployment Considerations..........................................................................................................293
VXI-11 LAN Server Installation and Configuration ........................................................................293
VXI-11 LAN Client Access Setup ..................................................................................................294
TekVISA Installation..................................................................................................................294
Application Examples....................................................................................................................299
Visual Basic Example................................................................................................................299
iv
MATLAB Example...................................................................................................................... 299
LabWindows/CVI Example........................................................................................................299
LabVIEW Example.................................................................................................................... 300
C Program Example.................................................................................................................. 300
Programming Tips......................................................................................................................... 300
Timeout Settings....................................................................................................................... 300
Non-TekVISA VXI-11 Clients .................................................................................................... 301
VXI-11 Standard ...........................................................................................................................301
APPENDIX C: OTHER VB EXAMPLES....................................................................................... 303
Introduction ................................................................................................................................... 303
Alternate Methods for Getting Waveform Data Using the TekVISA Control .................................303
Writing and Reading Binary/ASCII Waveform Example................................................................ 303
The User Interface .................................................................................................................... 305
How the Program Works........................................................................................................... 307
Code Listing.............................................................................................................................. 309
APPENDIX D: USING THE WAVEFORM GENERATOR ............................................................ 321
Introduction ................................................................................................................................... 321
To Generate a Live Waveform...................................................................................................... 321
Set up Your Display Mode ........................................................................................................ 321
Locate the Software and Examples for This Book ....................................................................323
Connect the Cable .................................................................................................................... 323
Start Up the Waveform Generator ............................................................................................ 324
Set Up the Oscilloscope and Calibrate the Sound Card ........................................................... 325
Generate the Waveform............................................................................................................ 327
Copy and Paste the Waveform Data into Excel........................................................................ 327
Export the Waveform into a File Appropriate for Excel .............................................................328
Import the Waveform into Excel................................................................................................ 328
INDEX........................................................................................................................................... 331
v
List of Figures
Figure 1: A Copy Setup box prepares waveform data for Excel ..... 2
Figure 2: TekVISA supports connectivity to programming
environments........................................................................... 5
Figure 3: Range of connections made possible by TekVISA
components............................................................................. 7
Figure 4: The path to LAN connectivity........................................... 8
Figure 5: Tektronix VXI Plug-n-Play Drivers integrate with
popular test automation software such as LabVIEW ............... 9
Figure 6: The TekExcel Toolbar in Excel ...................................... 13
Figure 7: How TekVISA ActiveX Controls interface with
Excel VBA and VB................................................................. 43
Figure 8: The form you will design for the GetWaveform
example................................................................................. 44
Figure 9: The Get Waveform form at runtime ............................... 45
Figure 10: Excel Clock Jitter example........................................... 46
Figure 11: Get Waveform form before changing default
properties............................................................................... 52
Figure 12: Using the VBA Help facility.......................................... 53
Figure 13: The redesigned form for Get Waveform ...................... 56
Figure 14: A object hierarchy from the Excel Object Model .......... 57
Figure 15: Using the Object Browser with Excel VBA................... 58
Figure 16: Related online help from the Object Browser .............. 59
Figure 17: The Clock Jitter example with the Get Waveform
program added ...................................................................... 73
Figure 18: Visual Basic 6.0 version of Get Waveform program .... 74
Figure 19: The form you will design for the Test Run example..... 78
Figure 20: The Test Run form at runtime...................................... 79
Figure 21: TekVISA Test Run form before changing default
captions and appearance of controls..................................... 81
Figure 22: The redesigned form for TekVISA Test Run................ 81
Figure 23: The Current Devices list box........................................ 82
Figure 24: The Measurement Commands frame .......................... 84
Figure 25: The Waveform Data frame .......................................... 88
Figure 26: The Send GPIB Commands frame.............................. 93
Figure 27: Visual Basic 6.0 version of the TekVISA Test Run
program ................................................................................. 96
Figure 28: The form you will design for the Chart
Measurements example ...................................................... 100
Figure 29: The Chart Measurements form at runtime................. 101
Figure 30: Chart Measurements plotted results.......................... 102
Figure 31: Chart Measurements form before changing default
captions and appearance of controls................................... 104
Figure 32: The redesigned form for Chart Measurements.......... 104
vi
Figure 33: How the Excel model incorporates charts ..................117
Figure 34: Visual Basic 6.0 version of Chart Measurement
program................................................................................121
Figure 35: The form you will design for the Triggered
Waveform Capture example.................................................128
Figure 36: The Triggered Waveform Capture form at runtime.....129
Figure 37: The Settings tab at design time..................................133
Figure 38: The TDS7000 Series Measurements tab at design
time.......................................................................................136
Figure 39: The TDS8000 Series Measurements tab at design
time.......................................................................................137
Figure 40: The Data tab at design time .......................................139
Figure 41: Using the Object Browser with Visual Basic 6.0.........141
Figure 42: The form module and code module in separate
Code Windows of VB............................................................143
Figure 43: Triggered Waveform Capture example flow diagram.144
Figure 44: The VISA Configuration Utility....................................168
Figure 45: MATLAB’s Instrument Control Toolbox ASCII
communication tool ..............................................................171
Figure 46: How commands and queries are funneled through
MATLAB functions................................................................173
Figure 47: The first screen of the jitter2 function in MATLAB ......181
Figure 48: The plotted graph solutions for jitter2 in the MATLAB
Figure Window .....................................................................182
Figure 49: Building a GUI using the MATLAB guide utility...........184
Figure 50: The MATLAB guide utility Property Inspector.............185
Figure 51: First page of completed jitter3 example in MATLAB...203 Figure 52: The plotted graph solutions for jitter3 in the MATLAB
Figure Window .....................................................................205
Figure 53: Plug-n-play Driver Help file for TDS/CSA8000 Series
oscilloscopes........................................................................207
Figure 54: The Measurement Capture program interface at
LabWindows/CVI design time...............................................212
Figure 55: Adding controls to a LabWindows/CVI panel..............213
Figure 56: Dialog box for editing attributes of the Dial control in
LabWindows/CVI..................................................................213
Figure 57: Page from the LabWindows/CVI Help file ..................216
Figure 58: The LabWindows/CVI Code Window .........................218
Figure 59: The LabWindows/CVI program while executing.........226
Figure 60: Page from the LabVIEW Tutorial in the Help file........232
Figure 61: Sample context help for a PnP Driver functon............233
Figure 62: The Front Panel for the LabVIEW example................246
Figure 63: The Block Diagram for the LabVIEW example...........252
Figure 64: The LabVIEW program while executing .....................253
Figure 65: LAN connectivity from PC applications to Tektronix
oscilloscope..........................................................................292
vii
Figure 66: VISA Configuration Window ...................................... 296
Figure 67: TekVISA Remote Host dialog box ............................. 298
Figure 68: Sample VISA program for LAN-based oscilloscope
access ................................................................................. 300
Figure 69: Design-time form for the Writing and Reading
Binary/ASCII Waveform example ........................................ 305
Figure 70: Runtime form for the Writing and Reading
Binary/ASCII Waveform example ........................................ 307
viii
List of Tables
Table 1: Table of typographic conventions.................................... xii
Table 2: Quick review of exporting and importing oscilloscope
data ..........................................................................................2
Table 3: Summary of TekExcel Toolbar buttons............................14
Table 4: Some command and control terminology ........................37
Table 5: Useful icons on the VBA Standard Toolbar .....................48
Table 6: Icons for VBA controls used in this book .........................50
Table 7: Changes to make in the Properties window to Get
Waveform...............................................................................54
Table 8: Property changes to make outside of frames in
TekVISA Test Run..................................................................82
Table 9: Property changes to make in the Measurement
Commands frame...................................................................83
Table 10: Measurements available in the Measurement
Commands frame...................................................................84
Table 11: Property changes to make in the Waveform Data
frame ......................................................................................87
Table 12: Property changes to make in the Send GPIB
Commands frame...................................................................92
Table 13: Changes to make in the Properties window to Chart
Measurements......................................................................104
Table 14: Useful icons on the VB Standard Toolbar....................130
Table 15: Icons for VB controls used in this example ..................132
Table 16: Changes to make in the Properties window to the
Settings tab ..........................................................................134
Table 17: Changes to make in the Properties window to the
TDS7000 Series Measurements tab ....................................137
Table 18: Changes to make in the Properties window to the
TDS8000 Series Measurements tab ....................................138
Table 19: Changes to make in the Properties window to the
Data tab................................................................................139
Table 20: List of Initialization routines..........................................144
Table 21: Routines involved in listing devices and displaying
channels...............................................................................146
Table 22: Routines involved in listing measurements to capture.148
Table 23: Routines involving dialog box buttons .........................150
Table 24: Routines involved in setting registers ..........................152
Table 25: Routines involved in handling trigger events ...............155
Table 26: Routines involved in getting measurement and
waveform data......................................................................155
Table 27: Routines involved in displaying results in the grid .......156
Table 28: Routines involved in saving data to disk......................156
Table 29: General purpose routines............................................157
ix
Table 30: Icons for MATLAB guide toolbar controls used in this
book..................................................................................... 184
Table 31: Changes to make in the Property Inspector to GUI
controls................................................................................ 187
Table 32: Relevant attributes of controls that appear on the
Measurement Capture panel in LabWindows/CVI ............... 214
Table 33: Relevant attributes of controls that appear on the
measuredemo.vi Front Panel in LabVIEW........................... 247
Table 34: TDS7000 Series native GPIB commands used in
examples in this book.......................................................... 256
Table 35: TDS7000 Series native GPIB queries used in
examples in this book.......................................................... 261
Table 36: Methods, properties and events of the TekVISA
ActiveX Control.................................................................... 263
Table 37: MATLAB Instrument Control Toolbox functions.......... 281
Table 38: TDS/CSA 8000 PnP driver functions used in
LabWindows/CVI and LabVIEW examples.......................... 287
Table 39: VISA operations used in LabVIEW and LAN Server
examples ............................................................................. 288
Table 40: Changes to make in the Properties window to the
Writing and Reading Binary/ASCII Waveform example....... 306
Table 41: Summary of functions in the Reading Binary/ASCII
Files example....................................................................... 308
x
What This Book is About

Preface

What This Book is About

This book shows you how to use a variety of popular tools to build graphical user interfaces to Tektronix Windows-based oscilloscopes. By using these “soft front panels,” you can quickly and easily connect your oscilloscope, whether locally or remotely, to the latest PC tools for analyzing waveform and measurement data. In addition, this book explores the functionality of the TekExcel Toolbar Add-In for Excel, which requires no additional programming.

Who Should Read This Book

Whether you are a novice who has never built a graphical user interface before or an experienced programmer, you will find this book helpful if you are interested in increasing your productivity with Tektronix Windows-based oscilloscopes. The examples cover programming environments ranging from Excel Visual Basic for Applications (VBA) and Visual Basic 6.0 to MATLAB, LabWindows/CVI, and LABVIEW. Familiarity with any or all of these environments is helpful but not necessary in order to work most of the examples.

How This Book is Organized

This book is divided into two parts. Each part includes multiple chapters and is designed to impart new information in progressive steps.
Part 1 covers the use of Excel with the TekExcel Toolbar and the TekVISA ActiveX control, and also includes Visual Basic 6.0 examples with the TekVISA ActiveX control.
Part 2 describes the use of MATLAB with the Instrument Control Toolbox, and the use of LabWindows/CVI and LabView with Tektronix Plug-n-Play drivers.
The appendices summarize the syntax of commands and controls used in the book, discuss LAN connectivity, present more complex examples, and describe the use of an optional Waveform Generator program to generate live waveforms for examples.
Oscilloscope Analysis and Connectivity Made Easy xi
Document Conventions
A CD-ROM accompanies this book. The CD-ROM includes the text of the book saved in PDF format, so you can use Adobe Acrobat Reader to access the book on-line. Also on the CD are the programming examples discussed in the book.

Document Conventions

This book makes use of certain notational conventions and typefaces in distinctive ways, as summarized in Table 1.
Table 1: Table of typographic conventions
Typeface Meaning Example
boldface
italics
SampleName
Note:
Code
Menu > Submenu
Used to emphasize important points and to denote exact characters to type or buttons to click in step-by-step procedures.
Used to introduce terms and to specify variables in syntax descriptions.
Used to designate the name of a function, statement, filename, or similar construct in regular body text.
Used to call attention to notes or tips in text.
Used to designate blocks of code.
Used to designate a series of cascading menus.
The example here means: from the Tools menu, choose Macro.
Connect your monitor to the
video port.
1. Click OK.
An industry-standard communications protocol called VXI-11
Attribute (type) = newvalue
You will employ a user­defined function called
Acquire_Instrument.
Note: Start here.
sCHCommands =
"DESE 1;*ESE 1;*SRE 32"
1. Choose Tools > Macro.
xii Oscilloscope Analysis and Connectivity Made Easy
Connectivity Made Easier

Chapter 1: Connectivity Building Blocks

Connectivity Made Easier

The first connectivity book to accompany a Windows-based Tektronix oscilloscope was entitled Oscilloscope Connectivity Made Easy. Since that book was published, Tektronix has added a number of new building blocks to make connectivity even more seamless and broad-based. These connectivity building blocks provide a new layer of middleware for connecting your Windows-based analysis programs to Tektronix embedded oscilloscope software.
The previous book showed you how to copy and paste or export and import data into three popular analysis programs: Excel, Mathcad, and MATLAB. That book also showed you how to use a stand-alone application to feed waveform data repeatedly into Excel or Mathcad.
This Oscilloscope Analysis and Connectivity Made Easy book gives you even more routes to jump-start connectivity to your favorite analysis program. You will:
explore new levels of connectivity to Excel and MATLAB
learn how to use Visual Basic to interact with your
oscilloscope in the Windows environment
acquire the tools and expertise to interconnect with the LabVIEW graphical programming environment

Built-in Connectivity Features

Because Excel and MATLAB are of special interest to our customers, Tektronix has built simple point-and-click interfaces from its oscilloscopes to these three programs. For example, Figure 1 shows the dialog box for copying TDS5000/7000 Series Oscilloscope waveform data to be pasted into Excel. The oscilloscope software also includes similar setup boxes for exporting data in a format suitable for MATLAB.
Oscilloscope Analysis and Connectivity Made Easy 1
Built-in Connectivity Features
Figure 1: A Copy Setup box prepares waveform data for Excel
Table 2 quickly reviews how to pass oscilloscope data to Excel and MATLAB. As shown in the table, you can use copy-and-paste or export-and­import techniques to move information from your oscilloscope to these programs.
Table 2: Quick review of exporting and importing oscilloscope data
To Copy / Export Data from
Microsoft
Excel with
Clipboard
Edit > Copy Setup
Menu Selections / Commands
Using
Using
Microsoft
Excel .txt File
File > Export Setup
Using MATLAB .dat File
File > Export Setup
TDS5000 and TDS7000 Series Oscilloscopes
To Copy / Export Data from
Edit > Copy Waveform
File > Export Waveform
TDS/CSA8000 Series Oscilloscopes
To Paste / Import Data into Excel / MATLAB
Edit > Paste Data > Get
External Data > Import Text File
or
Right-click and
Reference data filename as argument of M-file function call in Command Window
select
Refresh Data
2 Oscilloscope Analysis and Connectivity Made Easy
New Connectivity Building Blocks

New Connectivity Building Blocks

Now a number of new connectivity components have come on the scene. These new connectivity tools support faster and more seamless transfer of continuous live data into Excel and MATLAB. New connectivity building blocks also support other popular programming environments: Visual Basic as well as LabVIEW and LabWindows/CVI, a Measurement Studio component.
Tektronix latest connectivity solutions incorporate:
TekExcel Toolbar, an add-in that supports easy data capture into Microsoft Excel without any programming
TekVISA ActiveX Control, a Visual Basic OCX control that “wraps” and encapsulates the TekVISA library, enabling rapid application development in Visual Basic 6.0 or Visual Basic for Applications (VBA)Excel’s behind-the-scenes development environment
TekVISA API, a standard application programming interface (API) and common I/O library for connecting to and controlling measurement devices such as oscilloscopes
Internal “virtual”GPIB, a software resource built into TekVISA, that links the Windows processor to the embedded processor in Tektronix Windows-based oscilloscopes, permitting faster acquisitions than conventional GPIB hardware links
VXI Plug-n-Play Drivers, for Tektronix Windows-based oscilloscopes, capable of connecting with LabWindows/CVI and LabVIEW test automation software and other programming environments
Seamless connectivity with MATLAB via the Instrument Control Toolbox, available from The MathWorks, Inc.
VXI-11.2 Client/Server, technology for LAN connectivity
Oscilloscope Analysis and Connectivity Made Easy
3
New Connectivity Building Blocks
TekVISAA Standard Way to Connect
TekVISA is the new Tektronix implementation of the industry-standard library of common I/O operations known as VISA. VISA (Virtual Instrument Software Architecture) was the brainchild of the VXIplug&play Systems Alliance (http://www.vxipnp.org
), a group formed to standardize the building of instrumentation drivers. TekVISA’s set of operations, attributes, and events supports connectivity between application development environmentssuch as C++, Visual Basic, MATLAB, and LabVIEWand multiple kinds of resources including devices connected:
via a local GPIB connection
via a local Serial (RS-232) connection
via the Tektronix internal software connection known as
virtual GPIB
via a remote GPIB-LAN connection
remotely via virtual GPIB, Tektronix VXI-11 client/server
technology, and an Ethernet LAN connection
Figure 2 shows the broad range of connectivity brought together through TekVISA technology.
4 Oscilloscope Analysis and Connectivity Made Easy
New Connectivity Building Blocks
Figure 2: TekVISA supports connectivity to programming environments
TekExcel Toolbar
The easiest way to get up and running with your Windows-based oscilloscope is by making connections using the TekExcel Toolbar. This add­in to Microsoft Excel works just like any other toolbar in that application. When you click an icon, a dialog box pops up that allows you to pass information back and forth between the Microsoft Excel application and your Windows-based oscilloscope, without any programming modifications. If you need no special customization beyond the built-in toolbar functions, the TekExcel Toolbar will serve you well and get you going quickly, whether you are transferring oscilloscope measurements or captured waveforms into Excel. Chapter 2 introduces you to the use of this multi-purpose toolbar.
Oscilloscope Analysis and Connectivity Made Easy
5
New Connectivity Building Blocks
TekVISA ActiveX Control
The TekVISA ActiveX Control will make your job a lot easier if you are familiar with Visual Basic or Excel’s Visual Basic for Applications. This book explores some ways to use this powerful control to build fast connections from VB or VBA to the acquisitions side of your oscilloscope. With this tool, you can spend time using the programs that help you do your job, instead of losing time building complicated specialized instrument drivers out of sheer necessity, as was often required in the past. You can simply drop this control onto a form and then quickly design an interface with buttons and boxes to suit your needs.
If you just know a little bit about VB, the TekVISA ActiveX Control and the sample programs that come with this book will arm you with enough hands-on information to customize the examples given. Or, you can write your own pop-up dialogs between your oscilloscope and Excel or Visual Basic 6.0. Chapters 3 through 7, along with Table 36 in Appendix A, cover programming at this level using the TekVISA Control. Chapters 3 through 6 focus on using VBA with Excel spreadsheets, while Chapter 7 and Appendix C concentrate on using Visual Basic 6.0.
TekVISA API
If you are an accomplished VB or C++ programmer, you can write programs that call TekVISA operations directly, especially if you need more fine-grained control. The TekVISA API software now comes standard on Tektronix Windows-based oscilloscopes. The online TekVISA Programming Manual includes a lookup reference section and a tutorial section with programming examples. This subject matter is beyond the scope of this book.
Internal “Virtual” GPIB
TekVISA support for an internal resource called virtual GPIB means fast connectivity between Windows and the embedded software side of your oscilloscope. Virtual GPIB provides a software bridge to and from embedded oscilloscope software, permitting direct internal access to the oscilloscope for much faster and larger acquisitions than conventional GPIB ports. What is more, this feature facilitates remote connections with other PCs over a standard Ethernet LAN without the need for special GPIB-to-LAN hardware adapters.
TekVISA also includes Asynchronous Serial (ASRL) and GPIB resources that support more traditional connections to non-Windows-based instruments.
VXI-11.2 Client /Server Connected by Local Area Network (LAN)
Tektronix VXI-11.2 Client/Server technology adds another important piece to the connectivity picture. The VXI-11 Server-side component, combined with TekVISA’s virtual GPIB, provides a software passageway for connecting your Windows-based oscilloscope over an Ethernet LAN to remote PCs. On each remote PC, you would install another copy of TekVISA to make use of its built-in VXI-11 Client-side component.
6 Oscilloscope Analysis and Connectivity Made Easy
New Connectivity Building Blocks
You will need your own VXI-11 Client-side software if you want to connect UNIX-based systems to your Windows-based oscilloscope.
Appendix B discusses the details of accessing the oscilloscope across a local area network (LAN) from the programming environments discussed in this book. Figure 3 shows the range of connections made possible by the various TekVISA building block components. Figure 4 focuses on the components that make LAN connectivity possible.
Figure 3: Range of connections made possible by TekVISA components
Oscilloscope Analysis and Connectivity Made Easy
7
New Connectivity Building Blocks
Figure 4: The path to LAN connectivity
Tektronix Plug-n-Play Drivers with LabWindows/CVI and LabVIEW
Tektronix VXI Plug-n-Play drivers add another feature to the connectivity landscape, enabling easy linkage with popular test automation software such as LabVIEW (Figure 5) and LabWindows/CVI. VXI Plug-n-Play drivers for Tektronix Windows-based oscilloscopes add a layer of middleware so you can work in these graphical programming environments without spending a lot of time getting data in or out of your test equipment. Chapter 9 and Table 38 in Appendix A focus on connectivity scenarios using these graphical tools.
8 Oscilloscope Analysis and Connectivity Made Easy
New Connectivity Building Blocks
Figure 5: Tektronix VXI Plug-n-Play Drivers integrate with popular test automation software such as LabVIEW
MATLAB’s Instrument Control Toolbox
Anothr connectivity tool has emerged from The MathWorks, which now offers an Instrument Control Toolbox with MATLAB
. This toolbox makes
connectivity with Windows-based oscilloscopes such as the Tektronix TDS Family possible without complicated programming. Chapter 8 shows you how to import live waveforms into MATLAB using this new toolbox.
Oscilloscope Analysis and Connectivity Made Easy
9
New Connectivity Building Blocks
10 Oscilloscope Analysis and Connectivity Made Easy

PART 1: EXCEL AND VISUAL BASIC

CHAPTER 2: THE TEKEXCEL TOOLBAR 13
CHAPTER 3: UNDERSTANDING THE TEKVISA ACTIVEX CONTROL 37
CHAPTER 4: A SIMPLE PROGRAM TO GET WAVEFORMS 41
CHAPTER 5: A MORE COMPLEX FOUR-PART PROGRAM 77
CHAPTER 6: A MEASUREMENT CHARTING EXAMPLE 99
CHAPTER 7: A TRIGGERED DATA CAPTURE EXAMPLE 127
11
PART 1: EXCEL AND VISUAL BASIC
12 Oscilloscope Analysis and Connectivity Made Easy
Introduction

Chapter 2: The TekExcel Toolbar

Using the TekExcel Toolbar with Microsoft

Excel

Introduction

This chapter introduces you to the TekExcel Toolbara multi-purpose toolbar that allows you to place data from your Windows-based oscilloscope directly into an Excel document simply by clicking a few buttons. Easy acquisition is the heart of the toolbar. You can make single or repeated captures of data on a triggered, periodic, or timed basis, with the option of also graphing the data. Figure 6 shows the TekExcel Toolbar, which includes six button icons.
Figure 6: The TekExcel Toolbar in Excel
No programming is required in order to use the TekExcel Toolbar; however, the Visual Basic source code for the toolbar is available on the companion CD for experienced VB programmers who wish to modify toolbar features for their own use. In later chapters of this book, you will learn how to build less complicated VBA programs that implement some of the functions built into this toolbar.
Toolbar Prerequisites
You can use the TekExcel Toolbar with Microsoft Excel your Tektronix Windows-based oscilloscope or on a separate PC connected by a network to your oscilloscope. The oscilloscope and connected PC (if any) must each have TekVISA installed on it in order to establish a connection between Excel and your oscilloscope. See Appendix B for information about configuring access to networked oscilloscopes.
1
The toolbar runs as an Add-In to Microsoft Excel 2000 and XP.
1
running either on
Oscilloscope Analysis and Connectivity Made Easy 13
Adding the TekExcel Toolbar to Excel
Toolbar Features
The TekExcel Toolbar enables rapid capture of oscilloscope data from within Microsoft Excel worksheets. Table 3 describes the six buttons on the toolbar that work with the TDS5000, 6000, and 7000. Some other instruments do not offer all six buttons.
Table 3: Summary of TekExcel Toolbar buttons
Icon Button Name Meaning
Connect
Settings
Chooses the TekVISA-enabled oscilloscope with which to connect.
Saves oscilloscope settings to a file or Excel workbook, and restores oscilloscope settings from a file or Excel workbook. Settings saved into a workbook are automatically loaded into the oscilloscope when the workbook is opened.
Waveform
Measurement
Trigger Capture
Captures waveform data into a worksheet and graphs it.
Captures and graphs single or periodic waveform measurements.
Captures waveform data from an oscilloscope-defined trigger, places it into a worksheet, and graphs it.
Note: The TDS5000, 6000, and 7000 support this toolbar button. Other instruments do not.
Help
Launches the online help file for the TekExcel Toolbar.
The toolbar is easy to use. Click a button and a dialog box appears. Within dialog boxes, you can select the type of data you want to capture and automatically paste into Excel, along with an optional line chart.
If you let your mouse linger over a button, a tool tip will appear indicating the button’s function. Clicking the
Help button launches an online help file
for the TekExcel Toolbar (see page 34).
Adding the TekExcel Toolbar to Excel
The TekExcel Toolbar is an Excel Add-In. During toolbar installation, the toolbar file ( main TekVISA files.
14 Oscilloscope Analysis and Connectivity Made Easy
2
Assuming you are installing on the C: drive on a Windows 98 system, the toolbar is placed in
C:\VXIpnp\Win95\TEKvisa\ExcelToolbar\TekExcelToolbar.xla. On a Windows NT system, the toolbar is placed in C:\VXIpnp\WinNT\TEKvisa\ExcelToolbar\TekExcelToolbar.xla.
TekExcelToolbar.xla) is normally placed in a subdirectory of the
2
Connecting to Oscilloscopes
When you first install the TekExcel Toolbar, follow these steps to add it to Excel:
Start up Excel and select
Tools > Add-Ins… from the Excel menu bar.
The Add-Ins dialog box appears.
Select the check box next to
TekExcel Toolbar in the list of choices. If the
TekExcel Toolbar does not appear in the list, click the to the appropriate directory, and select the
TekExcelToolbar.xla file.
Browse… button, navigate
Click
OK.
The TekExcel Toolbar appears undocked in the Excel program.
Leave the toolbar undocked, or drag it up to the Excel Formatting Toolbar if you want it to remain docked in a fixed position.
Connecting to Oscilloscopes
The Connect button on the TekExcel Toolbar allows you to select a TekVISA-enabled oscilloscope with which to establish a connection.
To connect to a Tektronix Windows-based oscilloscope from within Excel:
1. Click the Connect button on the TekExcel Toolbar.
Oscilloscope Analysis and Connectivity Made Easy
15
Saving and Restoring Scope Settings
A dialog box similar to the following appears:
2. By default, the first GPIB device encountered in the
instrument list is selected.
3. Leave the selection as is, or select another instrument with
which to connect and click
OK.
The connection with the selected instrument is made. You may only connect to one instrument at a time using the TekExcel Toolbar.
Note: Click the Refresh button to display any changes to the list
of connected devices since the last time you clicked the Connect button.
Click the Identify button to display the instrument model number at the bottom of the dialog box.
Saving and Restoring Scope Settings
The Settings button on the TekExcel Toolbar allows you to save oscilloscope settings to a file or to an active Excel workbook, and restore them later to the oscilloscope.
If you save settings to an active worksheet and then save and reopen the associated Excel . oscilloscope.
xls file, the settings are automatically assigned to the
If you save settings to a file, you have the option of placing a descriptor in the settings file. The file can take one of two forms:
16 Oscilloscope Analysis and Connectivity Made Easy
Loading...
+ 316 hidden pages