Main Content

Use IVI-C Class-Compliant Drivers

The IVI-C class-compliant MATLAB® drivers provide an interface to MATLAB for instruments running on IVI-C class-compliant drivers. For a list of supported IVI-C class-compliant drivers, see Supported IVI Drivers.

This example uses a specific instrument, a Keysight™ MSO6104A oscilloscope. This feature works with any IVI-C class-compliant instrument. You can follow the basic steps, using your particular instrument if the device is IVI-C class-compliant.

Prerequisites

To use the driver you must have the following software installed.

  • Windows® 64-bit

  • Instrument Control Toolbox™ Support Package for National Instruments™ VISA and ICP Interfaces

  • Your instrument driver

  • Instrument Control Toolbox Support Package for IVI® and VXIplug&play Drivers

Read Waveforms Using the IVI-C Class-Compliant Interface

This example shows the general workflow to use with an IVI-C class-compliant device. This example uses a Keysight MSO6104A oscilloscope. This feature works with any IVI-C class-compliant instrument. You can follow the basic steps using your particular instrument if it is IVI-C class-compliant.

  1. Ensure all necessary software is installed. See Prerequisites for the list.

  2. Ensure that your instrument is recognized by the VISA utility. In this case, open Keysight Connectivity Expert and make sure it recognizes the oscilloscope.

  3. Set up the logical name using the Configuration Store. The VISA resource string shown in this code was acquired from the VISA utility in step 2.

    % Construct a configStore.
    configStore = iviconfigurationstore;
    
    % Set up the hardware asset called myScopeHWAsset, and resource description TCPIP0::a-m6104a-004598::INSTR.
    add(configStore, 'HardwareAsset', 'myScopeHWAsset', 'TCPIP0::a-m6104a-004598::INSTR');
    
    % Add a driver session called myScopeSession, and use the asset created in the step above. Ag546XX is the Agilent driver version. 
    add(configStore, 'DriverSession', 'myScopeSession', 'Ag546XX', 'myScopeHWAsset');
    
    % Add a logical name to the configStore called myScope and driver session called myScopeSession.
    add(configStore, 'LogicalName', 'myScope', 'myScopeSession');
    
    % Save the changes to the IVI configuration store data file.
    commit(configStore);
    

    For more information about the configuration store, see IVI Configuration Store.

  4. Connect to the instrument.

    dev = ividev("IviScope","myScope","IDQuery",true,"ResetDevice",true);
  5. Communicate with the instrument. For example, read a waveform.

    % Reset the instrument to a known state and automatically configure the measurement parameters.
    reset(dev)
    autoSetup(dev);
    
    % Create a record length variable. 
    recordLength = actualRecordLength(dev)
    
    % Read a waveform with channel name set to channel1 and timeout to 1000. 
    waveformArray = readWaveform(dev,"Channel1",recordLength,1000)
    
    % Plot the waveform and assign labels for the plot. 
    plot(waveformArray);
    xlabel("Samples");
    ylabel("Voltage");
  6. After configuring the instrument and retrieving its data, close the session and remove it from the workspace.

    clear dev

See Also

|