Real Time

Sample API Programs

Sample programs are placed in these default locations when you install the software:

C:\Users\<my account>\AppData\Roaming\Keysight\Signal Studio\Custom Modulation\Samples\ControlByGUI

C:\Users\<my account>\AppData\Roaming\Keysight\Signal Studio\Custom Modulation\Samples\SimpleControl

Using Microsoft Visual C# .NET or a similar IDE, you can modify these sample projects to develop your own API programs.

Basic Program Flow

You can create an API program by performing the following general steps. This sequence is demonstrated in the Main.cs file (C:\Users\<my account>\AppData\Roaming\Keysight\Signal Studio\Custom Modulation\Samples\SimpleControl\Main.cs).

  1. Create an API object.

  2. Configure the instrument connection.

  3. Clear all carriers.

  4. Configure the waveform.

  5. Add a framed carrier.

  6. Generate and download the waveform to the instrument.

  7. Turn on the RF output.

  8. End the program and turn off the RF output.

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

Simple Control Project

The Simple Control project (...\SimpleControl\SimpleControl.sln) provides a basic program for generating and downloading waveforms using API commands.

To view the code, open the SimpleControl.sln file using the Microsoft Visual C# .NET IDE, or open the Main.cs file using a text editor, such as Notepad. Since the SimpleControl.sln program flow does not use the API GUI, you will see only the code contained in the Main.cs file in the Code Editor, as shown in Figure 1.

Figure 1. Main.cs displayed in the Microsoft Visual C# .NET IDE

Control By GUI Sample Project

Using Microsoft Visual C# .NET, or a similar IDE, open the API_TEST project (...\Samples\ControlByGUI\API_TEST.sln). This displays a .NET API graphical user interface with two API mode selections (see Figure 2):

With GUI – settings that you configure using the .NET API GUI are displayed in the Signal Studio user interface, and are subsequently sent to the signal generator via the Signal Studio application. The Signal Studio GUI is automatically displayed when you select Debug mode. Using this mode enables you to see how changes in your program modify the parameters in the Signal Studio software interface.

No GUI – settings that you configure using the .NET API are not displayed in the Signal Studio user interface, but are sent directly to the API instance of the Signal Studio application and subsequently to the signal generator. 

Ensure that Keysight.SignalStudio.N7608B.dll is correctly displayed under References in the Solution Explorer. If the file is not listed, add it as follows:

  1. Select Project > Add Reference. A window opens in which you can select the reference files.

  2. Locate the directory C:\Program Files (x86)\Keysight\Signal Studio\Custom Modulation\Playback (This assumes that you installed the Signal Studio software in the default location).

  3. Highlight "Keysight.SignalStudio.N7608B.dll". 

  4. Click Add to add the file in the project as a reference.

Figure 2. API graphical user interface

To view the C# code in the API_TEST project, select the TestApiForm.cs tab in the Code Editor window in the Microsoft Visual C# .NET IDE and. See Figure 3

Figure 3. TestApiForm.cs displayed in the Microsoft Visual C# .NET IDE