Instrument Control Toolbox

Using VXIplug&play Drivers



In this example you will learn how to use a VXIplug&play driver with the Instrument Control Toolbox and MATLAB.

Many instrument manufacturers provide industry-standard VXIplug&play drivers for their instruments. Thes drivers expose the functionality of the instrument through a set of functions that are often easier to use than traditional ASCII commands and responses.

This example uses a VXIplug&play driver for the Agilent 5462xx series of oscilloscopes, but it also applies to all other VXIplug&play drivers.

Installing the Driver

Your first step is to install the VXIplug&play driver. You must install the driver before launching MATLAB. VXIplug&play drivers are provided in the form of a standard software installer from the instrument manufacturer. Run the installer, following the instructions the instrument manufacturer provides.

Validating Driver Installation

To confirm that the instrument driver is available after installation, use the instrhwinfo function.

vxipnpinfo = instrhwinfo('vxipnp')
vxipnpinfo = 

    InstalledDrivers: {1x76 cell}
      VXIPnPRootPath: 'C:\VXIPNP\WINNT'

ans = 

Columns 1 through 8

'AG5462XX' 'AG875X' 'AGE364XA' 'AVR375X' 'VTVM2716' 'ag3325b' 'arpps' 'as4XXX' 

Columns 9 through 17

'avd3186' 'avd3286' 'avr376x' 'avr6552' 'avsa' 'avulis' 'hp816x' 'ividcpwr' 

Columns 18 through 24

'ivifgen' 'ivipwrmeter' 'ivirfsiggen' 'iviscope' 'ivispecan' 'iviswtch' 

Columns 25 through 33

'rd126030' 'ri1260' 'ri2461' 'ri3155' 'ri3162' 'ri6075' 'ri8455' 'rsamiq' 

Columns 34 through 41

'rscmu200' 'rscmu2bt' 'rscmuc2k' 'rscmuk2a' 'rscmuk2g' 'rscmuk2t' 'rscmuk6w' 

Columns 42 through 50

'rscts' 'rsespi' 'rsfsex' 'rsfsh' 'rsfsp' 'rsfsq' 'rsfsu' 'rsngmo' 'rsngpt'

Columns 51 through 59

'rsngpx' 'rsnrp' 'rsnrt' 'rsnrtz' 'rsnrvd' 'rsnrvs' 'rssfl' 'rssfq' 'rssiam'

Columns 60 through 68

'rssifs' 'rssism' 'rssme' 'rssmiq' 'rssml' 'rssmp' 'rssmr' 'rssmt' 'rssmu'

Columns 69 through 76

'rssmv' 'rssmy' 'rsupl' 'rsurv55' 'rszv' 'terAI7' 'tktds2x0' 'xanxdc'

The output structure contains two fields. Any available VXIplug&play drivers are listed in the InstallledDrivers field. The VXIPnPRootPath provides information on where the VXIplug&play drivers are installed.

For additional information about a specific driver, use the instrhwinfo function with the driver name.

driverInfo = instrhwinfo('vxipnp', 'ag5462xx')
driverInfo = 

     Manufacturer: 'Agilent Technologies'
            Model: 'ag5462xx'
    DriverVersion: '1.0'
    DriverDllName: 'C:\VXIPNP\WINNT\bin\ag5462xx_32.dll'

Creating the MATLAB Instrument Driver

The Instrument Control Toolbox supports instrument driver communication using MATLAB instrument drivers. For VXIplug&play drivers, the MATLAB instrument driver is created from information in the VXIplug&play driver. The MATLAB instrument driver acts as a thin wrapper around the VXIplug&play driver for the toolbox to provide a consistent driver interface in MATLAB.

If the MATLAB instrument driver wrapper has not been created (or is not on the MATLAB path), it will not appear when using the instrhwinfo function with the 'matlab' argument.

matlabinfo = instrhwinfo('matlab')
matlabinfo = 

InstalledDrivers:{'agilent_33120a' 'agilent_34401a' 'agilent_e3648a' 
'tektronix_tds2024' [1x16 char]}

To create the MATLAB instrument driver wrapper, use the makemid function with the VXIplug&play driver name.


By default, this creates a file, ag5462xx.mdd, in the current directory. To specify a different name or location for the MATLAB instrument driver use the two argument form of makemid, where the second argument is the filename and/or pathname.

makemid('ag5462xx', 'ag5462xx_v1')

Typically the MATLAB instrument driver does not require any modification. However, note that you can customize the driver behavior and appearance in MATLAB using the MATLAB Instrument Driver Editor.

Verifying the MATLAB Instrument Driver

To verify that the new MATLAB instrument driver was created properly and is on the MATLAB path, use the instrhwinfo function.

matlabinfo = instrhwinfo('matlab')
matlabinfo = 

    InstalledDrivers: {'agilent_33120a'  'agilent_34401a'  'agilent_e3648a'  

driverinfo = instrhwinfo('matlab', 'ag5462xx')
The specified MATLAB instrument driver could not be found on the MATLAB path.

Using the MATLAB Instrument Driver

You can now use the MATLAB instrument driver to communicate with the instrument by creating a device object. A device object is a MATLAB variable that contains properties and methods for the instrument based on the information in the MATLAB instrument driver. The device object also uses the information in the MATLAB instrument driver to know how to use the VXIplug&play driver to communicate with the instrument.

A device object is created using the icdevice function. The first argument is the name of a MATLAB instrument driver. When using a VXIplug&play driver, the second argument is the VISA resource string that defines the hardware location of the instrument. For additional information in the icdevice function type instrhelp icdevice at the MATLAB command line, or consult the device object section of the documentation.

d = icdevice('ag5462xx', 'ASRL1::INSTR')

The display for the device object, created by the above command, provides basic information on the driver. A DriverType of MATLAB VXIplug&play indicates that the device object was create with a MATLAB instrument driver that is a wrapper for a VXIplug&play driver. You can also create MATLAB instrument drivers that wrap Interchangeable Virtual Instrument (IVI) drivers, or act as stand-alone instrument drivers that do not require additional instrument drivers.