VXIplug&play Drivers
Installing VXIplug&play Drivers
The VXIplug&play driver particular to a piece of equipment is usually provided by the equipment manufacturer as either an installation disk or as a Web download. Once the driver is installed, you can determine whether the configuration is visible to MATLAB® software by using the Test & Measurement Tool to view the current driver installations. Open the tool by typing:
tmtool
Expand the Instrument Drivers
node and click VXIplug&play
Drivers
. Click the Scan button to
update the display. All installed VXIplug&play drivers
will be listed.
Alternatively, you can use the function instrhwinfo
to find out which
drivers are installed.
instrhwinfo ('vxipnp') ans = InstalledDrivers: {'tktds5k', 'ag3325b', 'hpe363xa'} VXIPnPRootPath: 'C:\VXIPNP\WINNT'
The cell array returned for InstalledDrivers
contains
the names of all the installed VXIplug&play drivers.
The string returned for VXIPnPRootPath
indicates
where the drivers are installed.
Creating a MATLAB VXIplug&play Instrument Driver
To use a VXIplug&play driver with a device object, you must have a MATLAB VXIplug&play instrument driver based upon the information in the original VXIplug&play driver. The MATLAB VXIplug&play instrument driver, whether modified or not, acts as a wrapper to the VXIplug&play driver. You can download or create the MATLAB instrument driver.
Downloading a Driver from the MathWorks website
You might find an appropriate MATLAB driver wrapper for your instrument from the VXIplug&play page on the MathWorks website. You can search for the driver you need or you can submit a request to MathWorks for your particular driver.
To use the downloaded MATLAB VXIplug&play driver, you must also have the instrument's VXIplug&play driver installed. This driver is probably available from the instrument manufacturer's website.
Creating a Driver with makemid
The command-line function makemid
creates
a MATLAB VXIplug&play instrument driver
from a VXIplug&play driver, saving the new
driver in a file on disk. The syntax is
makemid('driver','filename')
where driver
is the original VXIplug&play instrument
driver name (identified by instrhwinfo
),
and filename
is the file containing
the resulting MATLAB instrument driver. See the makemid
reference page for details
on this function.
If you need to customize the driver, open the new driver in the MATLAB Instrument Driver Editor, modify it as required, and save it.
Note
When you create a MATLAB instrument driver based on a VXIplug&play driver, the original driver must remain installed on your system for you to use the new MATLAB instrument driver.
Importing with the MATLAB Instrument Driver Editor (midedit)
The MATLAB Instrument Driver Editor can import a VXIplug&play driver, thereby creating a MATLAB VXIplug&play instrument driver. You can evaluate or set the driver's functions and properties, and you can save the modified MATLAB instrument driver for further use:
Open the MATLAB Instrument Driver Editor with
midedit
.Select File > Import.
In the Import Driver dialog box, select the VXIplug&play driver that you want to import and click Import.
The MATLAB Instrument Driver Editor loads the driver and displays the components of the driver, as shown in the following figures.
MATLAB Instrument Driver Editor Showing tktds5k MATLAB Instrument Driver Summary
tktds5k MATLAB Instrument Driver Display Group Functions
With the MATLAB Instrument Driver Editor, you can:
Create, delete, modify, and rename properties, functions, or groups.
Add code around instrument commands for analysis.
Add create, connect, and disconnect code.
Save the driver as a MATLAB VXIplug&play instrument driver.
For more information, see MATLAB Instrument Driver Editor Overview.
Note
When you create a MATLAB instrument driver based on a VXIplug&play driver, the original driver must remain installed on your system for you to use the new MATLAB instrument driver.
Constructing Device Objects Using a MATLAB VXIplug&play Instrument Driver
Once you have the MATLAB VXIplug&play instrument
driver, you create the device object with the file name of the driver
and a VISA resource name as arguments for icdevice
.
For example:
obj = icdevice('MATLABVXIpnpDriver.mdd','GPIB0::2::INSTR') connect(obj)
See the icdevice
reference
page for full details about this function.
Creating Shared Libraries or Standalone Applications When Using IVI-C or VXI
When using IVI-C or VXIplug&play drivers, executing your code will generate additional file(s) in the folder specified by executing the following code at the MATLAB prompt:
sprintf('%s',[tempdir 'ICTDeploymentFiles'])
On all supported platforms, a file with the name
MATLABPrototypeFor<driverName>.m
is generated, where
<driverName>
the name of the IVI-C or
VXIplug&play driver. With 64-bit MATLAB on Windows®, a second file by the name
<driverName>_thunk_pcwin64.dll
is generated. When
creating your deployed application or shared library, manually include these
generated files. For more information on including additional files refer to the
MATLAB Compiler documentation.