Real Time

Sample API Programs

Two sample API programs are provided to illustrate the basic program flow for automating signal configuration and playback in a .NET programming environment. They are installed in the directories (default) shown below when you install the software:

Basic Program Flow

  1. Create API object.

  2. Configure the instrument connection.

  3. Clear the waveform

  4. Clear all carriers

  5. Add carrier

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

  7. Turn on RF output.

  8. End program and turn RF output off.

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

Simple Control Sample Project

The Simple Control project (...\Samples\SimpleControl\SimpleControl.sln), provides a simple basic program to generate and download waveforms using API commands.

To view the code, open the SimpleControl.sln file using the Microsoft Visual C# .NET application, or open the Main.cs file using another text editor, such as Notepad. Since the SimpleControl.sln program flow does not use a GUI, you will see only the source file code contained in the Main.cs file in the code editor, as shown below.

Figure 1: Source code of main.cs displayed in Microsoft Visual Studio C# .NET

Control By GUI Sample Project

  1. In the Microsoft Visual C# .NET, open the API_TEST.sln application (...\Samples\ControlByGUI\API_TEST.sln). This displays a .NET graphical user interface (see Figure 2) with two application modes.

  2. Make sure that Keysight.SignalStudio.N7601 appears as a reference to your API Project in the ClosedSolution Explorer. Using Microsoft Visual Studio .NET 2003 IDE, follow the steps below to add this reference, if needed. The steps may vary depending on your development environment.

    1. In the Project window, select Project > Add Reference from the menu.

    2. In the popup window that appears, browse to the directory: C:\Program Files (x86)\Keysight\Signal Studio\cdma (default installation directory) and select the files to be add.

    3. Click Add > OK to add them in the project as references.

  3. Select the API mode in the .NET graphical user interface to use when you configure the settings.

  4. To view the C# code in the API_TEST project, select the TestApiForm.cs tab in the code editor window (see Figure 3).

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

Figure 3: Source code of TestApiForm.cs displayed in Microsoft Visual Studio C# .NET