Overview

Programming the 34970A in Excel VBA or other languages is best done using the Keysight Instrument Code Wizard. This article explains how to quickly get a program written for the 34970A and perform data logging in Excel. The same technique can be applied to C or VEE as well as other instruments supported by the Keysight Instrument Code Wizard.

Keysight Instrument Code Wizard

The Keysight Instrument Code Wizard is a standalone application that creates executable code for several instruments including the 34970A, 34401A, and the 34980A. To use the Code Wizard, first download and install it from the Keysight web site:

Note: The Keysight 34401A dn 34980A are add-ins that require an additional install for each product.

Next, perform the following steps:

  1. Open the agtGPSCG_2.ZIP file.
  2. Run the setup.exe file.
  3. Read and accept the terms of the licensing agreement to continue.
  4. Click the button that looks like an icon.
  5. Select Keysight IntuiLink as the Program Group and click Continue.

Once installed, open the Instrument Code Wizard to create some executable code.

  1. Make sure you are connected to a 34970A or other supported device.
  2. Open the Instrument Code Wizard application from the menu Start > All Programs > Keysight IntuiLink > Instrument Code Wizard 2.0. You will see an application containing a menu and a blank window labeled Module 1 (the code created with the wizard will be placed in this window).
  3. Click on the menu item Instrument. You will see a list of instruments as shown in Figure 1. Select 34970A DAC/Switch.
  4. If the starting page comes up, click Next to advance to the page in Figure 2.
  5. You should now have the channel function page as shown in Figure 2. Enter a valid channel and function for the 34970A and click on the Add button. You can enter one or multiple channels in the Channels field like this: 101,102:105. Continue to add channels to the list, as necessary. The code generated will configure the listed channels.
  6. Click Next to set the number of scans and the time between each scan. The Scan List in the text box near the top of the screen defines the channels included in a scan. To keep the code simple, do not check any of the Include with Reading check boxes. Click on Next.
  7. Select Auto Scan. This will start the 34970A scan as soon as it receives the code. Ext. Trigger configures the 34970A to accept a hardware trigger, and Software Trigger requires a software trigger (*TRG). Click on Next.
  8. Select the software language that you will be using (Figure 3 shows the sample screen that would be used to do this). For this example we will select Excel VBA. Note that the syntax for the selected software language is shown in the Sample Code area. The code for Excel VBA is nearly identical to that of MS Visual Basic, except for additional code to insert data in an active Excel worksheet.
  9. Click on the IO Library button. A screen as shown in Figure 4 should pop up.
  10. In the GPIB IO Library frame select VISA COM. This determines the syntax that is used when communicating with the instrument. The selection also determines required references within the software project as shown in Table 1. Click on OK to return to the wizard dialog screen.
  11. Click Next and then Finish.
  12. The instruction dialog gives a brief description for using the code generated. This is repeated as a comment in the created code. Click OK. The code should now be in the active window of the Instrument Code Wizard.