Page 2
Further, to the maximum extent permitted notice until the ind icated provided to the public; or (2) Relinquish to, by applicable law, Keysight d isclaims all cond itions are fully understood and or otherwise provide, the government rights warranties, either express or implied, with in excess of these rights customarily met.
Our basic user programming model uses the IVI-COM driver directly and allows customer code to: • Access the IVI-COM driver at the lowest level • Control the Keysight P9241/42/43A oscilloscopes This guide describes: • Example Program: How to Print Driver Properties, Check for Errors, and Close Driver Sessions Additional example programs show how to perform waveform acquisitions.
What You Will Learn in This Programming Guide Related Documentation To access documentation related to the Keysight P9241/42/43A oscilloscopes, use one of the following methods: • The related documents are available on the product CD: Document Description File name Format...
When using the Visual Studio Integrated Development Environment (IDE), the Console Applications you write are stored in conceptual containers called Solutions and Projects. • You can view and access Solutions and Projects using the Solution Explorer window (View > Solution Explorer). Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Startup Guide, but repeated here must be completed before programmatically controlling the P9241/42/43A oscilloscope hardware with their IVI drivers. Install Keysight IO Libraries Suite 2018 Update 0.2 (or later); this installation includes Keysight Connection Expert. Install the P9241/42/43A oscilloscope software version 7.21 or later; this installation includes the AgInfiniiVision IVI driver version 2.4.1 or later.
Page 10
Once the software and hardware are installed, and after Self-Test has been performed, the P924xA USB oscilloscopes are ready to be programmatically controlled. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
IVI Instrument Currently, there are 13 IVI Instrument Classes defined by the IVI Foundation. The Classes (Defined P9241/42/43A oscilloscope belongs to the Oscilloscope IVI Instrument Class and by the IVI are therefore is described as a "Class" instrument. Foundation) •...
Page 12
APIs for the P9241/42/43A Oscilloscopes • Counter/Timer Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
APIs for the P9241/42/43A Oscilloscopes IVI Compliant or IVI Class Compliant The P9241/42/43A oscilloscopes driver is IVI Compliant and IVI Class Compliant because it belongs to one of the 13 IVI Instrument Classes defined by the IVI Foundation. • IVI Compliant – means that the IVI driver follows architectural specifications for these categories: •...
P9241/42/43A oscilloscopes • IVI Class-Compliant Specific Driver • IVI Specific Driver that complies with one (or more) of the IVI defined class specifications • Used when hardware independence is desired • IVI Custom Specific Driver Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 15
APIs for the P9241/42/43A Oscilloscopes • Is an IVI Specific Driver that is not compliant with any one of the 13 IVI defined class specifications • Not interchangeable Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
• These interfaces are organized into two hierarchies: Class-Compliant Hierarchy and Instrument-Specific Hierarchy – and both include the IIviDriver interfaces. • Class-Compliant Hierarchy - Because the P9241/42/43A oscilloscopes belong to one of the 13 IVI Classes, there is a Class-Compliant Hierarchy in its IVI Driver.
When Using Visual To view the interfaces available in the P924xA USB oscilloscope driver, right-click Studio AgInfiniiVisionLib library file, in the References folder, from the Solution Explorer window and select View in Object Browser. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 18
APIs for the P9241/42/43A Oscilloscopes Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Enumerations and enum values are used to represent discrete values in IVI-COM • <ClassName><descriptive words>Enum • Example: IviScopeTriggerCouplingEnum • Enum values do not end in "Enum" but use the last word to differentiate • Examples: IviScopeTriggerCouplingAC and IviScopeTriggerCouplingDC Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 20
APIs for the P9241/42/43A Oscilloscopes Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Enter "InfiniiVisionScopeProperties" as the Name of the project and click OK. When you select New, Visual Studio will create an empty "Program.cs" file that includes some NOTE necessary code, including using statements. This code is required, so do not delete it. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
To get the IVI drivers to appear in this list, you must close this Add Reference dialog, install the IVI drivers, and come back to this section and repeat "Step 2 - Add References" on page 23. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 24
To allow your program to access the IVI drivers without specifying full path names of each interface or enum, you need to add using statements to your program. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
You can create sections of code in your program that can be expanded and collapsed by NOTE surrounding the code with #region and #endregion preprocessing directives. Select – or + symbol to collapse or expand the region. Collapse Expand Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
AgInfiniiVision driver = new AgInfiniiVision(); The IVI-COM drivers may not be interchangeable with other oscilloscopes. operator is used in C# to create an instance of the driver. // Create driver instance AgInfiniiVision driver = new AgInfiniiVision(); Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Agilent/Keysight Connection Expert, Agilent/Keysight Command Expert, National Instruments Measurement and Automation Explorer (MAX), or you can use the Keysight product's Soft Front Panel (SFP) to get the physical Resource Name string. Using the Keysight P924x InfiniiVision SFP, you might get the following Resource Name address strings.
Page 28
"HiSLIP Address" Resource Name address string. To do this: In the the Keysight InfiniiVision SFP, select one of the P924xA InfiniiVision oscilloscopes and click its Show Front Panel icon. In the oscilloscope's Front Panel graphical user interface, choose (Menu) >...
(see Initialize() NOTE Initialize Options below), we are showing this example with a minimum set of options to help minimize complexity. // Define driver Initialize options string initOptions = "QueryInstrStatus=true, Simulate=false, DriverSetup Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
This feature also enhances software development by reducing the amount of keyboard input required. Initialize() Options The following table describes options that are most commonly used with the Initialize() method. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 31
If IdQuery is set to true, this will query the instrument model and fail initialization if the model is not supported by the driver. bool Reset = true; Setting Reset to true instructs the driver to initially reset the instrument. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 32
If these drivers were installed, additional information can be found under Initializing the IVI-COM Driver from the following: AgInfiniiVision IVI Start > All Programs > Keysight Instrument Drivers > IVI-COM-C AgInfiniiVision 2.2.3 Driver Reference Oscilloscope (Open driver root folder) In the driver root folder, double-click the "AgInfiniiVision.chm" file to open the driver reference.
Failing to do this could mean that system resources are not freed up and your program may behave unexpectedly on subsequent executions. // Close the driver if (driver != null && driver.Initialized) driver.Close(); Console.WriteLine("Driver Closed"); // Write "Done" to console Console.WriteLine("Done - Press Enter to Exit"); Console.ReadLine(); Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
After placing the example program statements in try/catch/finally blocks, separating the driver declaration from instance creation, and adding #region and #endregion preprocessor directives, you end up with an example program structure that looks like: Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
The example program full code listing looks like: #region Specify using Directives using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ivi.Driver.Interop; using Agilent.AgInfiniiVision.Interop; #endregion namespace InfiniiVisionScopeProperties class Program static void Main(string[] args) AgInfiniiVision driver = null; Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 38
(Exception ex) Console.WriteLine(ex.Message); finally #region Close Driver Instances // Close the driver if (driver != null && driver.Initialized) driver.Close(); Console.WriteLine("Driver Closed"); #endregion // Write "Done" to console Console.WriteLine("Done - Press Enter to Exit"); Console.ReadLine(); Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 39
Creating a Project with IVI-COM Using C-Sharp Additional Example Programs Additional example programs can be found in: C:\Program Files (x86)\IVI Foundation\IVI\Drivers\AgInfiniiVision\Examples Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 40
Creating a Project with IVI-COM Using C-Sharp Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 41
5 Creating a Project with IVI-COM Using Python You can use the Python programming language with the "comtypes" package to control Keysight oscilloscopes using the IVI-COM library. The Python language and "comtypes" package can be downloaded from the web http://www.python.org/ http://starship.python.net/crew/theller/comtypes/, respectively.
Page 45
# Error code == 0. break if errors_found: print "Exited because of error." sys.exit(1) # ========================================================= # Main program: # ========================================================= my_scope = CreateObject( 'AgInfiniiVision.AgInfiniiVision' # Initialize the oscilloscope, capture data, and analyze. initialize() capture() Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 46
Creating a Project with IVI-COM Using Python analyze() # Close the I/O session to the instrument. my_scope.Close() print "End of program" Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 47
Keysight P9241/42/43A Oscilloscopes IVI Programming Guide 6 References • Understanding Drivers and Direct I/O, Application Note 1465-3 (Keysight literature part number: 5989-0110EN) • www.ivifoundation.org...
Page 49
Keysight P9241/42/43A Oscilloscopes IVI Programming Guide Glossary ADE (application development environment) — An integrated suite of software development programs. ADEs may include a text editor, compiler, and debugger, as well as other tools used in creating, maintaining, and debugging application programs.
Page 50
Plug and Play drivers, you will need the VISA I/O library. The VISA standard was intended to provide a common set of function calls that are similar across physical interfaces. In practice, VISA libraries tend to be specific to the vendor's interface. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Page 51
VISA, but in terms of low-level I/O communication capabilities, VISA-COM is a subset of VISA. Agilent VISA-COM is used by its IVIComponent drivers and requires that Agilent VISA also be installed. Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
Need help?
Do you have a question about the P9241 and is the answer not in the manual?
Questions and answers