Sample API Programs

Several sample API programs are provided to illustrate the basic program flow for automating signal configuration and playback in a .NET programming environment. They are placed in the following locations when you install the software:

C:\Users\Public\Public Documents\Keysight\Multitone Distortion\ApiExamples

If you have existing API programs written for older versions of the N7621 software, they may need to be updated to work correctly with N7621B software version 3 and later. See Updating Older API programs for details.

Basic Program Flow

  1. Create API object.

  2. Configure the instrument connection.

  3. Test IO connections.

  4. Configure the waveform.

  5. Enable corrections

  6. Generate and download the waveform to the signal generator.

  7. Play the signal

Before editing the sample programs, make backup copies of all files. To save the files, you will need to right-click each file, select Properties, and de-select the Read-only attribute.

 

SimpleDownload Sample Project

The SimpleDownload sample project (...\ApiExamples\DotNet\SimpleDownload\SimpleDownload.sln), provides a simple, basic program to generate and download waveforms using API commands.

To view the code, open SimpleDownload.sln using the Microsoft Visual C# .NET application as shown in the figure below, or open SimpleDownload.cs using another text editor, such as Notepad.

Figure 1.  Source code of SimpleDownload.cs in Microsoft Visual C# .NET

 

To view the .NET GUI, click the SimpleDownload.cs [Design] tab as shown in the figure below.

Figure 2.  API Graphical User Interface displayed in Microsoft Visual C# .NET
 

Return to top