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.
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).
Create an API object.
Configure the instrument connection.
Clear all carriers.
Configure the waveform.
Add a framed carrier.
Generate and download the waveform to the instrument.
Turn on the RF output.
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
, and de-select the attribute.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
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):
– 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.
– 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:
Select
. A window opens in which you can select the reference files.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).
Highlight "Keysight.SignalStudio.N7608B.dll".
Click
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