agilent technologies 14565b automation interface · agilent technologies . 14565b : automation...

51
Agilent Technologies 14565B Automation Interface Programming Guide A

Upload: tranhanh

Post on 22-Jul-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Agilent Technologies 14565B Automation Interface

Programming Guide

A

Page 2: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Legal Notices © Agilent Technologies, Inc. 2007, 2008

No part of this document may be photocopied, reproduced, or translated to another language without the prior agreement and written consent of Agilent Technologies, Inc. as governed by United States and international copyright laws.

Warranty The material contained in this document is provided “as is,” and is subject to being changed, without notice, in future editions. Further, to the maximum extent permitted by applicable law, Agilent disclaims all warranties, either express or implied, with regard to this manual and any information contained herein, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Agilent shall not be liable for errors or for incidental or consequential damages in connection with the furnishing, use, or performance of this document or of any information contained herein. Should Agilent and the user have a separate written agreement with warranty terms covering the material in this document that conflict with these terms, the warranty terms in the separate agreement shall control.

Manual Editions First Edition, January, 2007 Update 1, September, 2008

Reprints of this manual containing minor corrections and updates may have the same printing date. Revised editions are identified by a new printing date.

Exclusive Remedies THE REMEDIES PROVIDED HEREIN ARE THE CUSTOMER'S SOLE AND EXCLUSIVE REMEDIES. AGILENT TECHNOLOGIES SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER BASED ON CONTRACT, TORT, OR ANY OTHER LEGAL THEORY.

Assistance This product comes with the standard product warranty. Warranty options, extended support contacts, product maintenance agreements and customer assistance agreements are also available. Contact your nearest Agilent Technologies Sales and Service office for further information on Agilent Technologies' full line of Support Programs.

Technologies Licenses The hardware and or software described in this document are furnished under a license and may be used or copied only in accordance with the terms of such license.

U.S. Government Restricted Rights Software and technical data rights granted to the federal government include only those rights customarily provided to end user customers. Agilent provides this customary commercial license in Software and technical data pursuant to FAR 12.211 (Technical Data) and 12.212 (Computer Software) and, for the Department of Defense, DFARS 252.227-7015 (Technical Data – Commercial Items) and DFARS 227.7202-3 (Rights in Commercial Computer Software or Computer Software Documentation).

Trademarks Microsoft and Windows are U.S. registered trademarks of Microsoft Corporation.

2 14565B Programming Guide

Page 3: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Contents 1 - Introduction ......................................................................................................................................5

Prerequisites ........................................................................................................ 6 Development Folder Summary .......................................................................... 6 The Client Environment ...................................................................................... 7

2 - Getting Started.................................................................................................................................9 Visual Basic 6.0 ................................................................................................. 10 Visual Basic for Applications .......................................................................... 15 Visual C# using the 14565B WTM driver ..................................................... 19 Visual Basic .NET using the 14565B WTM driver ....................................... 23 Agilent Vee ......................................................................................................... 26 National Instruments LabVIEW 7.1................................................................ 29

3 - Programming Examples................................................................................................................33 Error Checking.................................................................................................... 34 Voltage and Current Waveforms .................................................................... 35 Data Logging ...................................................................................................... 38 CCDF .................................................................................................................... 41

Appendix A - Creating a C++ Wrapper Class from a Type Library .............................................45 Visual Studio 6.0................................................................................................ 46 Visual Studio 2005............................................................................................. 47

Appendix B - Troubleshooting ...........................................................................................................49

Index......................................................................................................................................................51

14565B Programming Guide 3

Page 4: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script
Page 5: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

1 Introduction Prerequisites ........................................................................................................ 6 Development Folder Summary .......................................................................... 6 The Client Environment ...................................................................................... 7

The Agilent 14565B Automation Interface lets you leverage the functionality of the Agilent 14565B Device Characterization Software with an outside program like a test script. This guide applies to 14565B (Full Version), 14565U (Upgrade Version), and 14565E (Evaluation Version). All three versions will be referred to as 14565B in this document. The “B” version of the software distinguishes it from its predecessor, the Agilent 14565A Device Characterization Software, which did not provide an automation interface.

The Agilent 14565B Automation Interface is implemented using Component Object Model (COM). COM allows for communication between processes and follows the server-client model. In this case the Agilent 14565B Automation Interface is the server providing functionality and the test script is the client making calls to the server.

The following chapters will describe setting up various environments for use with the Agilent 14565B Automation Interface and then gives several programming examples.

NOTE You can contact Agilent Technologies at one of the following telephone numbers for warranty, service, or technical support information. In the United States: (800) 829-4444 In Europe: 31 20 547 2111 In Japan: 0120-421-345 Or use our Web link for information on contacting Agilent in your country or specific location: www.agilent.com/find/assist Or contact your Agilent Technologies Representative.

The web contains the most up to date version of the manuals. Go to http://www.agilent.com/find/14565 to get the latest version of the manuals.

14565B Programming Guide 5

Page 6: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

1 Introduction

Prerequisites Before you begin, make sure that you have installed the Agilent 14565B Device Characterization Software using the provided installer.

Using the provided installer is recommended because the installer will automatically register a Type Library containing the Agilent 14565B Automation Interface on your computer. The Agilent 14565B Type Library will subsequently show up on your computer’s list of COM components under the name “Agilent 14565B Type Library (Ver x.x)”.

Development Folder Summary The Development folder for the Agilent 14565B Automation Interface is located in My Documents\Agilent\14565B\Development\14565B Examples.zip\. The Development folder contains examples, documentation, drivers, and other files used for the Agilent 14565B Automation Interface.

Directory Description

Automation Samples\ Project Starters are projects that illustrate the bare minimum needed to get started using the Agilent 14565B Automation Interface. These projects correspond to the directions given in chapter 2 for setting up the client environment. Measurement examples are projects illustrating the automation of Agilent 14565B Waveform Capture, CCDF, and Data Logging.

WTM Driver\ An instrument driver for the Agilent Wireless Test Manager (WTM) .NET development or generic .NET development that wraps Agilent 14565B Automation Interface function calls. There is a single compilation of the driver for .NET Framework 1.1 if using Visual Studio 2003, which should also work on .NET Framework 2.0 if using Visual Studio 2005. The Agilent 14565B WTM driver provides the same functions as the 14565B COM Interface, but the functions are categorized and provide XML IntelliSense comments at design time.

WTM Test Steps\ Test Steps that can be added to an Agilent Wireless Test Manager (WTM) development project and used in the WTM run-time. These test steps provide Agilent 14565B functionality in WTM. Refer to the Agilent 14565B WTM Interface Guide for additional information.

6 14565B Programming Guide

Page 7: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Introduction 1

14565B Programming Guide 7

The Client Environment In this guide, the client stands for the program that will make automation calls to the Agilent 14565B Automation Interface. The Agilent 14565B Automation Interface functions as the server. It can be called from any programming language or program that can use COM components. The following sections will discuss these common programming languages:

• Visual Basic 6.0

• Visual Basic for Applications (VBA)

• Visual C# (.NET)

• Visual Basic (.NET)

The Integrated Development Environments (IDEs) described in this guide are Microsoft Visual Studio 6.0 and Microsoft Visual Studio .NET 2003, but most IDEs should be sufficient for using with the Agilent 14565B Automation Interface.

NOTE Visual Studio 2005 is capable of opening and converting Visual Studio .NET 2003 projects.

In addition, directions for setting up the Agilent 14565B Automation Interface will be discussed for the following client programs:

• Agilent VEE

• National Instrument LabView.

Refer to the Agilent 14565B WTM Interface Guide for information about setting up the Agilent 14565B Automation Interface with the Agilent Wireless Test Manager.

Page 8: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script
Page 9: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started Visual Basic 6.0 ................................................................................................. 10 Visual Basic for Applications .......................................................................... 15 Visual C# using the 14565B WTM driver ..................................................... 19 Visual Basic .NET using the 14565B WTM driver ....................................... 23 Agilent Vee ......................................................................................................... 26 National Instruments LabVIEW 7.1................................................................ 29

This chapter describes how to get started using the Agilent 14565B Automation Interface using the programming languages and applications listed above.

14565B Programming Guide 9

Page 10: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Visual Basic 6.0 Visual Basic 6.0 and other languages provide two ways of declaring object variables. The difference between the two is at what point in time the object gets assigned its specific object type. The first time it can be assigned is at design time - called Early Binding. The second time it can be assigned is at runtime - called Late Binding.

We at Agilent Technologies strongly recommend using Early Binding whenever possible. This is because an IDE can provide the list of member functions and parameters of the object at design time and perform optimizations to the code at compile time. For more in depth information search for the MSDN knowledge base article titled “INFO: Using Early Binding and Late Binding in Automation”.

Step 1. The first step in either case is to create a new Visual Basic 6.0 Standard EXE project

10 14565B Programming Guide

Page 11: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Early Bound Implementation (recommended) The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\VS60 VB Early Bind\.

Step 2. After the project is created, from the Project menu click on References.

Step 3. From the Available References list in the dialog find and check Agilent 14565B Type Library. On top of the list also make sure that Ole Automation is checked. If it is not checked look for it in the list and check it.

14565B Programming Guide 11

Page 12: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Step 4. The next step will be to declare a variable of the Agilent 14565B class type. Right-click on the dialog editor and choose View Code. The code will most likely be blank, so on the first line declare a global variable:

Dim ag14565B As Agilent14565B

Step 5. Test to see that the Agilent 14565B Automation Interface works. Go to the dialog editor and add a button. Change the label and the name of the button to “Launch 14565B” and “Launch”, respectively. Double click on the newly created button to create the function for the Click event.

Step 6. In the Launch_Click() function add the following code to instantiate the object. Modify the resourceDescriptor string "GPIB::5::INSTR" in the Initialize function for the instrument you are connecting to. Then launch Agilent 14546B and connect.

Private Sub Launch_Click() Set ag14565B = New Agilent14565B ag14565B.Initialize ag14565BVisa, "GPIB::5::INSTR", 0 ag14565B.ShowWindow ag14565BShow End Sub

12 14565B Programming Guide

Page 13: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Step 7. Close down the Agilent 14565B when the VB application closes. Add the function for the Form Terminate event.

Step 8. Add the following code:

Private Sub Form_Terminate() ag14565B.Close End Sub

Step 9. Now run the program. Clicking the launch button on the dialog should launch the Agilent 14565B. Closing the dialog should also close down the Agilent 14565B.

14565B Programming Guide 13

Page 14: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Late Bound Implementation The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\VS60 VB Late Bind\.

Step 1. After creating a new Standard EXE project, right-click on the dialog and choose View Code. Declare the global variable:

Dim ag14565B As Object

Step 2. In the dialog editor add a button. Change the label and the name of

the button to Launch 14565B and Launch, respectively. Double click on the newly created button to create the function for the Click event:

Step 3. In the Launch_Click function, add the following code. Modify the resourceDescriptor string "GPIB::5::INSTR" in the Initialize function for the instrument you are connecting to.

Private Sub Launch_Click() Set ag14565B = CreateObject("14565B") ag14565B.Initialize 1, "GPIB::5::INSTR", 0 ag14565B.ShowWindow 1 End Sub

NOTE The late bound object does not provide a list of member functions after you type “ag14565B.” There are also no enumerators as parameters.

Step 4. Now run the program. Clicking the launch button on the dialog should launch the Agilent 14565B. Closing the dialog should also close down the Agilent 14565B.

14 14565B Programming Guide

Page 15: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Visual Basic for Applications The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\Excel VBA\.

Visual Basic for Applications (VBA) allows the writing of scripts in Microsoft Office applications to automate processes. Using Excel and VBA is of particular interest since Excel provides us with a way of collecting data as well as making calculations and visualizing it.

Step 1. Start Excel and begin with an empty spreadsheet. Excel comes with two toolbars that are frequently used when writing VBA scripts. Right click on the toolbar and enable the Visual Basic and Control Toolbox.

Step 2. In the Visual Basic toolbar, click on the Visual Basic Editor to bring up the code editor. Note that you can also access the Visual Basic Editor from Tool -> Macro -> Visual Basic Editor.

14565B Programming Guide 15

Page 16: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Double click on Sheet1 in the left pane to open the source code for Sheet1. From the Tools menu, click on References:

Step 3. From the Available References list in the dialog find and check Agilent 14565B Type Library. On top of the list, also make sure that Ole Automation is checked. If it is not checked look for it in the list and check it.

Step 4. Declare a variable of the 14565B class type. In the Sheet1 source code type:

Dim ag14565B As Agilent14565B

Step 6. Switch back to the Excel window and click on the Design Mode icon in the Visual Basic toolbar. You will now be able to add controls to the spreadsheet like buttons and textboxes.

16 14565B Programming Guide

Page 17: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Add a button from the Control Toolbox to the spreadsheet.

Step 7. Right-click on the button and click on Properties. In the Properties dialog change the name to “Launch” and the caption to “Launch 14565B”. Setting AutoSize to True will resize the button to fit the caption.

Step 8. Now double-click on the button to add the function for the Click event. This should take you to the code editor. In the Launch_Click function, add the following code to instantiate the object. Modify the resourceDescriptor string "GPIB::5::INSTR" in the Initialize function for the instrument you are connecting to. Then launch 14565B and connect.

Private Sub Launch_Click() Set ag14565B = New Agilent14565B ag14565B.Initialize ag14565BVisa, "GPIB::5::INSTR", 0 ag14565B.ShowWindow ag14565BShow End Sub

Step 9.To run the code, switch back to the Excel window and click on the Design Mode icon again to exit design mode.

14565B Programming Guide 17

Page 18: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Then click on the newly created Launch 14565B button.

18 14565B Programming Guide

Page 19: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Visual C# using the 14565B WTM driver The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\VS2003 C# using WTM Driver\.

This section describes using the 14565B Wireless Test Manager (WTM) Driver in a non-WTM program. These procedures can also be followed when writing a C# program with the standard 14565B COM component, except the function calls have to be modified not to use categorical interfaces. For example, calling ag14565B.Initialize(…) instead of ag14565B.Session().Initialize(…).

Step 1. Start Microsoft Visual Studio 2003. From the File menu click on New -> Project. In the New Project dialog choose a Visual C# Windows Application. Type in a name and location and press OK.

14565B Programming Guide 19

Page 20: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Step 2. In the Solution Explorer of the newly created project, right-click on References and the click Add Reference... In the .NET tab, click Browse...

Select the 14565B WTM Driver for Visual Studio 2003 named Agilent.WTM.ag14565BMoM.dll found in Development/WTM Driver/VS2003 .NET Framework 1.1/.

NOTE You may instead choose the 14565B Type Library under the COM tab in References. This will use the Agilent 14565B Automation Interface directly, but the interface functions will not be categorized and there will be no functions comments at design time.

Step 3. Go to Form1.cs Code view and add the following after the using statements on top:

using Agilent.WTM.ag14565BMoM;

In the namespace scope code, add the following after the Main() function. This declares a global variable named ag14565B of the 14565B WTM driver

private ag14565BControl ag14565B;

Step 4. Open Form1.cs in the Designer view and add a button from Toolbox -> Common Controls. Change the Text property of the button to “Launch 14565B” and the Name property to “Launch”.

Double click on the button to create the event handler function for the click event. The name of the function will be Launch_Click() if you named the button Launch

20 14565B Programming Guide

Page 21: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Place the following code into the function. Modify the resourceDescriptor string "GPIB::5::INSTR" in the Initialize function for the instrument you are connecting to.

private void Launch_Click(object sender, System.EventArgs e) {

ag14565B = new ag14565BControl(); try { ag14565B.Session().Initialize(ag14565BIOLibraryEnum.ag14565BVisa, "GPIB::5::INSTR", 0); ag14565B.Utility().ShowWindow(ag14565BShowWindowEnum.ag14565BShow); } catch (Exception ex) { MessageBox.Show(ex.Message); } }

14565B Programming Guide 21

Page 22: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Step 5. Run the program. When you click on the Launch 14565B button, you should see 14565B launching in the Tray Icon area. You have to manually close the 14565B.

22 14565B Programming Guide

Page 23: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Visual Basic .NET using the 14565B WTM driver The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\VS2003 VB.NET using WTM Driver\.

This section describes using the 14565B Wireless Test Manager (WTM) Driver in a non-WTM program. These procedures can also be followed when writing a VB .NET program with the standard 14565B COM component, except the function calls have to be modified not to use categorical interfaces. For example, calling ag14565B.Initialize(…) instead of ag14565B.Session.Initialize(…).

Step 1. Start Microsoft Visual Studio 2003. From the File menu click on New -> Project. In the New Project dialog choose Visual Basic Project -> Windows Application. Type in a name and location and click OK.

14565B Programming Guide 23

Page 24: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Step 2. In the Solution Explorer of the newly created project, right-click on References and click Add References... In the .NET tab click Browse...

Select the 14565B WTM Driver for Visual Studio 2003 named Agilent.WTM.ag14565BMoM.dll found in Development/WTM Driver/ VS2003 .NET Framework 1.1/.

NOTE You may instead choose the 14565B Type Library under the COM tab in References. This will use the Agilent 14565B Automation Interface directly, but the interface functions will not be categorized and there will be no functions comments at design time.

Step 3. Go to Form1.cs Code view and declare a variable of the 14565B WTM driver inside the class for Form1 as follows:

private ag14565B As Agilent.WTM.ag14565BMoM.ag14565BControl

Step 4. Open Form1.vb in the Designer view and add a button from Toolbox -> Common Controls. Change the Text property of the button to “Launch 14565B” and the Name property to “Launch”.

Double click on the button to create the event handler function for the click event. The name of the function will be Launch_Click() if you named the button Launch

24 14565B Programming Guide

Page 25: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Place the following code into the function. Modify the resourceDescriptor string "GPIB::5::INSTR" in the Initialize function for the instrument you are connecting to.

Private Sub Launch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Launch.Click ag14565B = New Agilent.WTM.ag14565BMoM.ag14565BControl Try ag14565B.Session.Initialize(Agilent.WTM.ag14565BMoM.ag14565BIOLibraryEnum.ag14565BVisa, "GPIB::5::INSTR", 0) ag14565B.Utility.ShowWindow(Agilent.WTM.ag14565BMoM.ag14565BShowWindowEnum.ag14565BShow) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub

Step 5. Run the program. When you click on the Launch 14565B button, you should see 14565B launching in the Tray Icon area. You have to manually close the 14565B.

14565B Programming Guide 25

Page 26: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Agilent Vee The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\VEE\.

Step 1. Create a new Agilent VEE program. Click Device -> ActiveX Automation References... Locate and check Agilent 14565B Type Library. Then click OK.

Step 2. Click Data -> Variable -> Declare Variable and place it on the surface.

26 14565B Programming Guide

Page 27: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Fill in the properties as follows: Name: ag14565B Scope: Global Type: Object Sub Type: COM

Click the Edit… button and choose Library: Agilent14565BLib Class: Agilent14565B

Step 3. Click Device -> Formula and place it on the surface.

Delete the Input and Output Terminals by right clicking on the formula window and choosing Delete Terminal. In the formula box type the following to instantiate the variable. Set ag14565B = CreateObject("14565B");

Step 4. To connect to the power supply and make measurements, you may continue adding commands to the formula box. For example the following connects, takes a current measurement, and reads back the average.

Set ag14565B = CreateObject("14565B"); ag14565B.Initialize(ag14565BVisa, "GPIB3::5::INSTR", 5); ag14565B.SetupCurrWaveformMeas(ag14565BTime6ms, ag14565BTrigAuto, 0, 0, 0); ag14565B.StartMeasurement(); A = ag14565B.GetWaveformMeas(ag14565BDC); ag14565B.Close();

14565B Programming Guide 27

Page 28: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Instead of writing the code in the formula box, you may create individual containers for the functions called. To do that open the Function & Object Browser and click on ActiveX Object.

In here you may choose a function and click Crate Call to create a container for that function. See example2.vee in My Documents\ Agilent\14565B\Development\14565B Examples.zip\Project Starters\VEE\ for an example using multiple containers

28 14565B Programming Guide

Page 29: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

National Instruments LabVIEW 7.1 The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Project Starters\LabVIEW\.

Step 1. Create a New Blank VI. In the Front Panel View, right-click and navigate to All Controls->Refnum->Automation Refnum.

Place the Automation Refnum. Right-click on the Refnum and choose Select ActiveX Class->Browse...

14565B Programming Guide 29

Page 30: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

Choose Agilent 14565B Type Library Version x.x and select Agilent14565B (14565B) from the list. Then Click OK.

Your should see the following dialog:

Step 2. Go to the Block Diagram view by right-clicking the Refnum and choosing Find Terminal. In the Block Diagram view, right-click on the Refnum and choose ActiveX Pallete->Automation Open. This will create an instance of the 14565B COM Object.

Place the Automation Open icon and connect it to the Refnum as shown:

30 14565B Programming Guide

Page 31: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Getting Started 2

Right-click on the Automation Open and choose ActiveX Palette->Invoke Node.

Place and connect the Invoke Node as follows:

Click on Method and choose Initialize. This will be the function call to connect 14565B to the power supply.

Step 3 You may now create text and numeric fields in the Front Panel view to ask the user for connection parameters. However, this example will use constants as the parameters for simplicity purposes. Next to each parameter input arrow, right-click and choose Create -> Constant.

14565B Programming Guide 31

Page 32: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

2 Getting Started

32 14565B Programming Guide

Fill in the constants with appropriate values. This example used ioLibrary: ag14565BVisa enum, resourceDescriptor: GPIB3::5::INSTR, and ioAddress: 5.

Step 4 You can now run the diagram, but 14565B will just open and close. To prevent that, set a breakpoint on the Initialize method by right-clicking its icon and clicking Set Breakpoint. After Initialize you may add more Invoke Nodes and call other 14565B automation functions in a similar manner the Initialize function was called. The final steps should be to call the Close function and then add and connect the Close Reference icon.

Page 33: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

3 Programming Examples Error Checking.................................................................................................... 34 Voltage and Current Waveforms .................................................................... 35 Data Logging ...................................................................................................... 38 CCDF .................................................................................................................... 41

After setting up your project, you are probably ready to write some test functions using the Agilent 14565B Automation Interface.

This chapter will describe the procedures for performing Current and Voltage Waveforms, CCDF, and Data Logging. The language used in these examples is C# under Visual Studio 2003. The example resumes where the setup for the C# project in the previous chapter ended.

Before describing the programming procedures, the chapter discusses an important and often ignored part of programming: error checking.

14565B Programming Guide 33

Page 34: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

4 Programming Examples

Error Checking Many of the functions in the Agilent 14565B Automation Interface return an error code of type long. The return code is as follows:

Return Value: Meaning: 0 (zero) - 1 non-zero integer

No errpr 14565B program-specific error Power supply or driver-specific error

There is usually an error message associated with an error. To retrieve the first message in the error queue, call GetErrorMessage(). If the error happened earlier, the message stays in the queue until GetErrorMessage() is called. It is important to empty out the queue until it returns null as shown in the following code: String msg; msg = GetErrorMessage(); while( msg != null ) { // Do something with the message here msg = GetErrorMessage(); }

To keep the test functions more legible, create an error checking function that will take the return type of a 14565B function and check the error message if it is non-zero. For simplicity purposes, the function only retrieves the most recent error message. private int CheckError(int errorCode) { if (errorCode != 0) { MessageBox.Show("Error: " + ag14565B.GetErrorMessage() + "."); } return errorCode; }

Now your test function structure can look like:

CheckError( ag14565B.SetVoltageLevel(ag14565BChannel1, 3.6) ); CheckError( ag14565B.SetCurrentLimit(.ag14565BChannel1, 5.0) );

Instead of bringing up a message box in the CheckError function, you could also throw an exception that an exception handler somewhere in the program could catch. The code for that would look like this: private int CheckError2(int errorCode) { if (errorCode != 0) { throw new Exception(“Error: " + ag14565B.GetErrorMessage() + "."); } return errorCode; }

NOTE The 14565B WTM driver generates exceptions when an error occurs. To capture exceptions, use the try{…} and catch(…){…} programming structure.

34 14565B Programming Guide

Page 35: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Programming Examples 4

Voltage and Current Waveforms The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Measurement Examples\WaveformCapture\.

Continuing from the C# starter project, the first step is to create a new button with the properties Name: “Capture” and Text: “Capture Waveform”. Double-click on the button to create the function for the click event. Also, create a button with the properties Name: “Close” and Text: “Close 14565B”. Double-click this button to create the function for the click event. The following example is a Current Waveform capture. The steps for most captures are:

1. Call Reset() to reset the Agilent 14565B and power supply.

2. Call the Current Waveform Setup function.

3. Get the estimated duration of the capture. This will be longer than the measurement time alone since the I/O transfer takes some time.

4. Set up the power supply.

5. Start the capture.

6. Halt the host program execution while the Agilent 14565B captures the data.

7. Request, gather, and analyze the measurement(s).

8. Save the captured waveform for later analysis if needed.

NOTE You have to call the acquisition mode setup function before making any calls that setup the power supply. The four acquisition mode setup functions are SetupDlogAcq, SetupCCDFAcq, SetupCurrWaveformMeas, and SetupVoltWaveformMeas.

The source for a current waveform procedure is as follows:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Agilent14565BLib; namespace TestProgram { public partial class WaveformForm : Form { private Agilent14565BClass ag14565B;

14565B Programming Guide 35

Page 36: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

4 Programming Examples

public WaveformForm() { InitializeComponent(); } private int CheckError(int errorCode) { if (errorCode != 0) { MessageBox.Show("Error: " + ag14565B.GetErrorMessage() + "."); } return errorCode; } private void Launch_Click(object sender, EventArgs e) { if (ag14565B == null ) { ag14565B = new Agilent14565BClass(); CheckError( ag14565B.Initialize(ag14565BIOLibraryEnum.ag14565BVisa, "GPIB0::5::INSTR", 5) ); Capture.Enabled = true; } } private void Capture_Click(object sender, EventArgs e) { double maxCurrent, dc, acdc, low, high, min, max; int durationMS; String resultsMessage; // Reset 14565B and the power supply (note: this should be done before any of the setup calls) CheckError(ag14565B.Reset()); // Setup 14565B to do a Current waveform CheckError( ag14565B.SetupCurrWaveformMeas(ag14565BWaveformMeasTimeEnum.ag14565BTime300ms, ag14565BWaveformTrigModeEnum.ag14565BTrigAuto, 0, 0, 0) ); // Get the total time for the capture and transfer of the data to 14565B durationMS = ag14565B.GetWaveformDuration(); // Setup the Power Supply CheckError( ag14565B.SetSenseCurrRange(ag14565BSenseCurrRangeEnum.ag14565BCurrRangeHigh) ); CheckError( ag14565B.SetSenseCurrType(ag14565BSenseCurrTypeEnum.ag14565BCurrTypeDC) ); CheckError( ag14565B.SetVoltageLevel(ag14565BChannelEnum.ag14565BChannel1, 3.6) ); maxCurrent = ag14565B.QueryCurrentLimitMax(ag14565BChannelEnum.ag14565BChannel1); CheckError( ag14565B.SetCurrentLimit(ag14565BChannelEnum.ag14565BChannel1, maxCurrent) ); CheckError( ag14565B.SetOutputCoupling(false) ); CheckError( ag14565B.SetEnabled(ag14565BChannelEnum.ag14565BChannel1, true) );

36 14565B Programming Guide

Page 37: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Programming Examples 4

MessageBox.Show("Turn on test device and Click OK to start measurement. Duration is about " + (durationMS / 1000 + 1) + " seconds", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Start the waveform capture CheckError( ag14565B.StartMeasurement() ); // Sleep while 14565B is busy, there could be a more elegant way // to pass the time, but this is the simplest System.Threading.Thread.Sleep(durationMS); // Retrieve the measured values CheckError( ag14565B.GetWaveformMeasAll(out dc, out acdc, out low, out high, out min, out max) ); // Do something productive with the values, for now let's just display them in a Message Box resultsMessage = String.Format("Results:\nDC: {0:F5} AC/DC: {1:F5}\nLow: {2:F5} High: {3:F5}\nMin: {4:F5} Max: {5:F5}", dc, acdc, low, high, min, max); MessageBox.Show(resultsMessage, "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Choose a directory and filename where to save the waveform for later analysis (this is optional) const string directory = @"saved waves\waveform"; // Make a filename with the starting time in the name string filename = "waveform %t.txt"; MessageBox.Show("Saving data log to: " + directory + "\\" + filename + ".", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Save the waveform to a file so we can analyze it later CheckError( ag14565B.SaveWaveform(directory, filename) ); } private void Close_Click(object sender, EventArgs e) { if (ag14565B != null) { ag14565B.Close(); ag14565B = null; Capture.Enabled = false; } } } }

14565B Programming Guide 37

Page 38: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

4 Programming Examples

Data Logging The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Measurement Examples\Data Logging\.

Continuing from the C# starter project, the first step is to create a new button with the properties Name: “StartDataLogging” and Text: “Start Data Logging”. Double-click on the button to create the function for the click event. Also create a button with the properties Name: “Close” and Text: “Close 14565B”. Double-click this button to create the function for the click event. The following example is a Data Log acquisition. The steps for most data logs are:

1. Call Reset() to reset the Agilent 14565B and power supply.

2. Call the Dlog Setup function.

3. Set up the power supply.

4. Start the data log acquisition.

5. Halt the host program execution while 14565B does the acquisition. Keep track of the time remaining by calling the Data Log Time Remaining function.

6. Request, gather, and analyze the measurement(s).

7. Save the captured data log for later analysis if needed.

NOTE You have to call the acquisition mode setup function before making any calls that setup the power supply. The four acquisition mode setup functions are SetupDlogAcq, SetupCCDFAcq, SetupCurrWaveformMeas, and SetupVoltWaveformMeas.

The source for a data log procedure is as follows:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Agilent14565BLib; namespace TestProgram { public partial class DlogForm : Form { private Agilent14565BClass ag14565B; public DlogForm() { InitializeComponent(); }

38 14565B Programming Guide

Page 39: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Programming Examples 4

private int CheckError(int errorCode) { if (errorCode != 0) { MessageBox.Show("Error: " + ag14565B.GetErrorMessage() + "."); } return errorCode; } private void Launch_Click(object sender, EventArgs e) { if (ag14565B == null ) { ag14565B = new Agilent14565BClass(); CheckError( ag14565B.Initialize(ag14565BIOLibraryEnum.ag14565BVisa, "GPIB0::5::INSTR", 5) ); StartDataLogging.Enabled = true; } } private void StartDataLogging_Click(object sender, EventArgs e) { double maxCurrent, avg, min, max; int timeRemainingSeconds; String resultsMessage; // Reset 14565B and the power supply (note: this should come before any of the setup calls) CheckError( ag14565B.Reset() ); // Setup 14565B to do a Data Logging acqusition CheckError( ag14565B.SetupDlogAcq(ag14565BDlogSenseTypeEnum.ag14565BDlogCurr, 0, 0, 30, .005) ); // Setup the Power Supply CheckError( ag14565B.SetSenseCurrRange(ag14565BSenseCurrRangeEnum.ag14565BCurrRangeHigh) ); CheckError( ag14565B.SetSenseCurrType(ag14565BSenseCurrTypeEnum.ag14565BCurrTypeDC) ); CheckError( ag14565B.SetVoltageLevel(ag14565BChannelEnum.ag14565BChannel1, 3.6) ); maxCurrent = ag14565B.QueryCurrentLimitMax(ag14565BChannelEnum.ag14565BChannel1); CheckError( ag14565B.SetCurrentLimit(ag14565BChannelEnum.ag14565BChannel1, maxCurrent) ); CheckError( ag14565B.SetOutputCoupling(false) ); CheckError( ag14565B.SetEnabled(ag14565BChannelEnum.ag14565BChannel1, true) ); MessageBox.Show("Turn on test device and Click OK to start Data Logging.", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Start the Data Logging acqusition CheckError( ag14565B.StartMeasurement() );

14565B Programming Guide 39

Page 40: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

4 Programming Examples

// This halts the program timeRemainingSeconds = ag14565B.GetDlogTimeRemaining(); while (timeRemainingSeconds > 0) { TimeRemainingTextbox.Text = timeRemainingSeconds + " s"; Application.DoEvents(); System.Threading.Thread.Sleep(250); // Sleep for 250ms to give up CPU time timeRemainingSeconds = ag14565B.GetDlogTimeRemaining(); } // Retrieve the measured values CheckError( ag14565B.GetDlogMeasAll(ag14565BDlogMeasTypeEnum.ag14565BDlogMeasCurr, out avg, out min, out max) ); // Do something productive with the values, for now let's just display them in a Message Box resultsMessage = String.Format("Results: Average: {0:F5} Min: {1:F5} Max: {2:F5}", avg, min, max); MessageBox.Show(resultsMessage, "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Choose a directory and filename where to save the waveform for later analysis (this is optional) const string directory = @"saved waves\data logs"; // Make a filename with the starting time in the name string filename = "datalog %t.bin"; // Save the waveform to a file so we can analyze it later MessageBox.Show("Saving data log to: " + directory + "\\" + filename + ".", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); CheckError( ag14565B.SaveDlog(directory, filename) ); TimeRemainingTextbox.Text = ""; } private void Close_Click(object sender, EventArgs e) { if (ag14565B != null) { ag14565B.Close(); ag14565B = null; StartDataLogging.Enabled = false; } } } }

40 14565B Programming Guide

Page 41: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Programming Examples 4

CCDF The source code is located in the following directory: My Documents\Agilent\14565B\Development\14565B Examples.zip\Measurement Examples\CCDF\.

Continuing from the C# starter project, the first step is to create a new button with the properties Name: “StartCCDF” and Text: “Start CCDF”. Double-click on the button to create the function for the click event. Also create a button with the properties Name: “Close” and Text: “Close 14565B”. Double-click this button to create the function for the click event. The following example is a CCDF acquisition. The steps for most CCDF acquisitions are:

1. Call Reset() to reset the Agilent 14565B and power supply.

2. Call the CCDF Setup function.

3. Set up the power supply.

4. Start the CCDF acquisition.

5. Halt the host program execution while 14565B does the acquisition. Keep track of the time remaining by calling the CCDF Time Remaining function.

6. Request, gather, and analyze the measurement(s).

7. Save the captured CCDF for later analysis if needed.

NOTE You have to call the acquisition mode setup function before making any calls that setup the power supply. The four acquisition mode setup functions are SetupDlogAcq, SetupCCDFAcq, SetupCurrWaveformMeas, and SetupVoltWaveformMeas.

The source for a CCDF procedure is as follows:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Agilent14565BLib; namespace TestProgram { public partial class CCDFForm : Form { private Agilent14565BClass ag14565B; public CCDFForm() { InitializeComponent(); }

14565B Programming Guide 41

Page 42: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

4 Programming Examples

private int CheckError(int errorCode) { if (errorCode != 0) { MessageBox.Show("Error: " + ag14565B.GetErrorMessage() + "."); } return errorCode; } private void Launch_Click(object sender, EventArgs e) { if (ag14565B == null ) { ag14565B = new Agilent14565BClass(); CheckError( ag14565B.Initialize(ag14565BIOLibraryEnum.ag14565BVisa, "GPIB0::5::INSTR", 5) ); StartCCDF.Enabled = true; } } private void StartCCDF_Click(object sender, EventArgs e) { double maxCurrent; int timeRemainingSeconds; double dc, dcPercentile, value10Percentile, value1Percentile, value0point1Percentile, peakValue; String resultsMessage; // Reset 14565B and the power supply (note: this should come before any of the setup calls) CheckError( ag14565B.Reset() ); // Setup 14565B to do a CCDF acqusition CheckError( ag14565B.SetupCCDFAcq(ag14565BCCDFSenseTypeEnum.ag14565BCCDFCurr, 0, 0, 45) ); // Setup the Power Supply CheckError( ag14565B.SetSenseCurrRange(ag14565BSenseCurrRangeEnum.ag14565BCurrRangeHigh) ); CheckError( ag14565B.SetSenseCurrType(ag14565BSenseCurrTypeEnum.ag14565BCurrTypeDC) ); CheckError( ag14565B.SetVoltageLevel(ag14565BChannelEnum.ag14565BChannel1, 3.6) ); maxCurrent = ag14565B.QueryCurrentLimitMax(ag14565BChannelEnum.ag14565BChannel1); CheckError( ag14565B.SetCurrentLimit(ag14565BChannelEnum.ag14565BChannel1, maxCurrent) ); CheckError( ag14565B.SetOutputCoupling(false) ); CheckError( ag14565B.SetEnabled(ag14565BChannelEnum.ag14565BChannel1, true) ); MessageBox.Show("Turn on test device and Click OK to start CCDF acquisition.", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Start the Data Logging acqusition CheckError( ag14565B.StartMeasurement() );

42 14565B Programming Guide

Page 43: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Programming Examples 4

14565B Programming Guide 43

// This halts the program timeRemainingSeconds = ag14565B.GetCCDFTimeRemaining(); while (timeRemainingSeconds > 0) { TimeRemainingTextbox.Text = timeRemainingSeconds + " s"; Application.DoEvents(); System.Threading.Thread.Sleep(250); // Sleep for 250ms to give up CPU time timeRemainingSeconds = ag14565B.GetCCDFTimeRemaining(); } // Retrieve the measured values CheckError( ag14565B.GetCCDFMeasAll(out dc, out dcPercentile, out value10Percentile, out value1Percentile, out value0point1Percentile, out peakValue) ); // Do something productive with the values, for now let's just display them in a Message Box resultsMessage = String.Format("Results: DC: {0:F5} ({1:F1}th Percentile)\n10th Percentile: {2:F5}\n1st Percentile: {3:F5}" + "\n0.1th Percentile: {4:F5}\nPeak Value: {5:F5}", dc, dcPercentile, value10Percentile, value1Percentile, value0point1Percentile, peakValue); MessageBox.Show(resultsMessage, "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Choose a directory and filename where to save the waveform for later analysis (this is optional) const string directory = @"saved waves\CCDFs"; // Make a filename with the starting time in the name string filename = "CCDF %t.txt"; MessageBox.Show("Saving ccdf data to: " + directory + "\\" + filename + ".", "14565B Example", MessageBoxButtons.OK, MessageBoxIcon.Information); // Save the waveform to a file so we can analyze it later CheckError( ag14565B.SaveCCDF(directory, filename) ); TimeRemainingTextbox.Text = ""; } private void Close_Click(object sender, EventArgs e) { if (ag14565B != null) { ag14565B.Close(); ag14565B = null; StartCCDF.Enabled = false; } } } }

Page 44: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script
Page 45: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Appendix A Creating a C++ Wrapper Class from a Type Library Visual Studio 6.0................................................................................................ 46 Visual Studio 2005............................................................................................. 47

The Agilent 14565B Automation Interface definition is in the type library file AG14565B.tlb. Many programming languages can use this file directly to provide function definitions during the coding stage without the need to generate a wrapper class. In C++ you have to generate a class that will contain the function calls of the type library.

The wrapper class inherits from COleDispatchDriver. The MSDN describes the base class as follows:

OLE dispatch interfaces provide access to an object's methods and properties. Member functions of COleDispatchDriver attach, detach, create, and release a dispatch connection of type IDispatch. Other member functions use variable argument lists to simplify calling IDispatch::Invoke.

An instance of the wrapper class is known as a Late-Bound object (for more information about Late vs Early Binding see the section of Visual Basic 6.0). The compiler does not know the Agilent 14565B Automation Interface exists until Runtime. So the first thing we have to do if you want to use the wrapper class instance is to call it’s inherited function CreateDispatch() with the name of the registered COM Type name (this is a name that is placed in the registry when 14565B is run or RegSvr32.exe is called to register the type).

14565B Programming Guide 45

Page 46: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Appendix A Creating a C++ Wrapper Class

Visual Studio 6.0 Step 1. To generate an Agilent 14565B Automation Interface C++ wrapper

class from the 14565B Type Library file (AG14565B.tlb) use the Visual Studio 6.0 ClassWizard. Begin with a Visual C++ MFC Project.

Go into the ClassWizard (View menu or Ctrl+W). In the Message Maps tab click on the New Class dropdown button and choose From a type library...

Step 2. Browse to My Documents\Agilent\14565B\Development\14565B Examples.zip\ and choose AG14565B.tlb. This file contains the definition of the COM interface functions provided by 14565B. Visual Studio will create a wrapper source and header file.

Step 3. Rename the class name from “IAgilent14565B” to “CAgilent14565B” to follow standard naming conventions. Press OK on this dialog and the ClassWizard dialog in order to complete the wrapper creation.

46 14565B Programming Guide

Page 47: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Creating a C++ Wrapper Class Appendix A

Visual Studio 2005 Step 1. Begin with a Visual C++ MFC Project. To generate an Agilent 14565B

Automation Interface C++ wrapper class from the 14565B Type Library file (AG14565B.tlb), go into the Class View and right-click on the project name. Then click on Add->Class.

14565B Programming Guide 47

Page 48: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Appendix A Creating a C++ Wrapper Class

48 14565B Programming Guide

Step 2. Choose MFC and Class from TypeLib. Click Add.

Step 3. In the next window you can either point to the AG14565B.tlb file or reach the file by using the registry entry. This example used the registry entry. Select the IAgilent14565B Interface and click the “>” button to select it as one of the Generated classes. Click Finish

Page 49: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

Appendix B Troubleshooting

Issue: I am getting an error message saying “There are already two copies of 14565B running. Please close one or both instances of the program.” when trying to run 14565B in automation, but I do not see any 14565B icons in the system tray.

If the 14565B did not shut down completely during previous runs, there may still be instances of it running in the background. You have to close them down to get rid of this error message. To do that:

1. Open Windows Task Manager by right-clicking on the taskbar.

2. Click the Processes Tab and sort the items by Image Name. Sort by clicking on the Image Name column header.

3. You should see AG14565B.exe in the Image Name list. Right-click on each one and choose “End Process”.

Issue: I connect to a power supply in automation, but I lose the connection right away.

Check the system tray to see if there is another instance of 14565B running in the background that is connected to the same power supply. Right-click and Exit the instances to close them both down. Then try connecting again.

Issue: I am having trouble connecting to a power supply in automation.

Open the 14565B from the Start menu and go to the I/O Configuration dialog under the Source menu. Click the Auto-Detect button and check if the software connected to the correct power supply. After it connects, go back to I/O Configuration dialog and note the IO Type, Instrument Address, and Interface Name.

Use those values when connecting in automation using the Initialize function. Note that Visa Library connections can have the Instrument Address left as 0 in automation.

14565B Programming Guide 49

Page 50: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script
Page 51: Agilent Technologies 14565B Automation Interface · Agilent Technologies . 14565B : Automation Interface . Programming Guide . ... with an outside program like a test script

14565B Programming Guide 51

Index

A

Agilent VEE......................................................................... 26 automation calls .................................................................. 7

C

C++ wrapper class.............................................................. 6 catch (…) ..........................................................34, 35, 38, 41 client ...................................................................................... 5 COM....................................................................................... 5 contact numbers.................................................................. 5

E

Early bound implementation............................................ 11 error checking .................................................................... 34 evaluation version ............................................................... 5 example

CCDF................................................................................ 41 current waveform ......................................................... 35 date logging ................................................................... 38 voltage waveform ......................................................... 35

Excel..................................................................................... 15

F

folders.................................................................................... 6 form terminate event descriptor..................................... 13 full version ............................................................................ 5

G

GetErrorMessage()............................................................ 34

H

history.................................................................................... 2

I

IDEs........................................................................................ 7

L

LabVIEW.............................................................................. 29 Late bound implementation............................................. 14

P

prerequisites......................................................................... 6 print date ............................................................................... 2 programming samples ........................................................ 6

R

resource descriptor ........................................14, 17, 21, 25

S

server ..................................................................................... 5

T

try {…}...............................................................34, 35, 38, 41 type library .......................................................................... 45 type library ............................................................................ 6

U

upgrade version.................................................................... 5

V

VBA ...................................................................................... 15 VEE ....................................................................................... 26 Visual Basic .NET .............................................................. 23 Visual Basic 6.0.................................................................. 10 Visual C#............................................................................. 19 Visual Studio 2005............................................................... 7

W

Web URL’s ............................................................................ 5 wireless test manager ........................................................ 6 WTM driver ........................................................................... 6 WTM test steps ................................................................... 6