Keysight P9241 Programming Manual
Hide thumbs Also See for P9241:

Advertisement

Quick Links

Keysight P9241/42/43A
Oscilloscopes
IVI Programming
Guide

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the P9241 and is the answer not in the manual?

Questions and answers

Summary of Contents for Keysight P9241

  • Page 1 Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • 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.
  • Page 3: Table Of Contents

    Related Websites / 6 Related Documentation / 7 Overall Process Flow / 8 2 Installing Hardware, Software, and Licenses 3 APIs for the P9241/42/43A Oscilloscopes IVI Compliant or IVI Class Compliant / 13 IVI Driver Types / 14 IVI Driver Hierarchy / 16...
  • Page 4 Additional Example Programs / 39 5 Creating a Project with IVI-COM Using Python 6 References 7 Glossary Index Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 5: What You Will Learn In This Programming Guide

    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.
  • Page 6: Related Websites

    GPIB, USB, & Instrument Control Products • Keysight VEE Pro • Technical Support, Manuals, & Downloads • Contact Keysight Test & Measurement • IVI Foundation - Usage Guides, Specifications, Shared Components Downloads • MSDN Online Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 7: Related Documentation

    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...
  • Page 8: Overall Process Flow

    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...
  • Page 9: Installing Hardware, Software, And Licenses

    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...
  • Page 11: Apis For The P9241/42/43A Oscilloscopes

    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...
  • Page 13: Ivi Compliant Or Ivi Class Compliant

    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: •...
  • Page 14: Ivi Driver Types

    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...
  • Page 16: Ivi Driver Hierarchy

    • 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.
  • Page 17: Class-Complaint And Instrument-Specific Hierarchies For The P924Xa

    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...
  • Page 19: Naming Conventions Used To Program Ivi Drivers

    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...
  • Page 21: Creating A Project With Ivi-Com Using C-Sharp

    Keysight P9241/42/43A Oscilloscopes IVI Programming Guide 4 Creating a Project with IVI-COM Using C-Sharp Step 1 - Create a Console Application / 22 Step 2 - Add References / 23 Step 3 - Add "using" Statements / 25 Step 4 - Create Instance of the IVI-COM Driver / 26...
  • Page 22: Step 1 - Create A Console Application

    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...
  • Page 23: Step 2 - Add References

    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...
  • Page 25: Step 3 - Add "Using" Statements

    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...
  • Page 26: Step 4 - Create Instance Of The Ivi-Com Driver

    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...
  • Page 27: Step 5 - Initialize The Driver Instance

    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) >...
  • Page 29: Initialize() Parameters

    (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...
  • Page 30: Initialize() Options

    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.
  • Page 33: Step 6 - Write The Program Steps

    (int i = 0; i < Points; i++) Console.Write("{0}, ", WaveformArray[i]); Console.WriteLine(); // Check instrument for errors int errorNum = -1; string errorMsg = null; Console.WriteLine(); while (errorNum != 0) driver.Utility.ErrorQuery(ref errorNum, ref errorMsg); Console.WriteLine("ErrorQuery: {0}, {1}", errorNum, errorMsg); Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 34: Step 7 - Close The Driver

    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...
  • Page 35: Step 8 - Building And Running A Complete Program Using Visual C-Sharp

    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...
  • Page 36: Example Program - Full Code Listing

    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 37 System.Double XIncrement = 5; driver.Measurements.AutoSetup(); driver.Measurements.Initiate(); driver.Measurements.get_Item("Channel1").FetchWaveform(ref Wavef ormArray, ref InitialX, ref XIncrement); Console.WriteLine("\ nInitialX: {0} XIncrement: {1}", InitialX, XIncrement); System.Int32 Points = WaveformArray.Length; Console.Write("\n\nData Points: {0}\n\nWaveformArray: \ n", Points); if (Points > 100) Points = 100; 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 42 "Specification minor version: '%s'" % my_scope.Identity.Specifica tionMinorVersion print "Supported instrument models: '%s'" % my_scope.Identity.Supported InstrumentModels print "Vendor: '%s'" % my_scope.Identity.Vendor print "Serial number: '%s'" % my_scope.System.SerialNumber # Place oscilloscope in known state. my_scope.Utility.Reset() # ========================================================= Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 43 = 2.075 # Parameters can be configured using properties print "Channel 1 vertical range: %f" % ch1.Range print "Channel 1 vertical offset: %f" % ch1.Offset # Set horizontal scale and offset. my_scope.Acquisition.ConfigureRecord( TimePerRecord=0.005, NumberOfPointsMin=1000, StartTime=-0.0025 Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 44 # -------------------------------------------------------- my_scope.Display2.InvertColorEnabled = False image_bytes = my_scope.Display.GetScreenBitmap( ImageFormat=AgInfiniiVisionLib.AgInfiniiVisionDisplayImageFormatPNG, Palette=AgInfiniiVisionLib.AgInfiniiVisionDisplayPaletteColor f = open("screen.png", "wb") f.write(bytearray(image_bytes)) f.close() print "Screen image written to screen.png." # Download waveform data. # -------------------------------------------------------- (wfm_data, x_origin, x_increment) = my_scope.Measurements.Item('Channel 1').FetchWaveform() Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • 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 48 References Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • 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...
  • Page 52 Glossary Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 53 IVI class driver, RecordCoercions initialization option, driver types, IVI, IVI COM drivers, reference, IVI driver, driver, closing, IVI driver, references, driver, IVI, IVI driver naming conventions, references, adding, DriverSetup, Initialize() option, IVI driver types, Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...
  • Page 54 Reset, Initialize() option, resource names, ResourceName, Initialize() option, running a program, Simulate initialization option, specific driver, IVI, sub-interface names, Trace initialization option, using statements, adding, VISA (Virtual Instrument Software Architecture), VISA-COM, Visual Studio, viewing interfaces, warranty, Keysight P9241/42/43A Oscilloscopes IVI Programming Guide...

This manual is also suitable for:

P9243aP9242

Table of Contents