from
Using Instrument Drivers in MATLAB
by Patrick Edson
Examples of using industry standard and MATLAB instrument drivers with the Instrument Control Toolbo
|
| vxipnp_ex.m |
% This script demonstrates using a VXIplug&play driver for the first time.
% Once the MATLAB instrument driver wrapper is created, the first part of
% this script can be skipped.
%
% This examples assumes that you have installed the Agilent AGE364XA
% VXIplug&play driver. You can substitute any other VXIplug&play driver as
% applicable.
% Create the wrapper that allows the toolbox to communicate with the driver.
makemid('AGE364XA', 'MyPSDriver');
% Create a device object to represent the instrument driver functions and
% properties in MATLAB. Pass the instrument location (a VISA resource name) as
% the second argument to the constructor.
deviceObj = icdevice('MyPSDriver', 'GPIB0::6::INSTR');
% Connect to the device. This calls Age364xa_init() in the driver.
connect(deviceObj);
% View basic information about the object and driver
display(deviceObj)
% View all of the root object properties
get(deviceObj)
% View all of the root object functions
methods(deviceObj)
% View the methods of one of the group objects. A group object is a special
% property of the device object that contains other properties and functions.
% The groups are based on how functions are categorized in the driver.
groupObj = get(deviceObj, 'Application');
methods(groupObj)
% View the help for a specific driver function.
instrhelp(groupObj, 'outputvoltcurr')
% Invoke a specific driver function.
invoke(groupObj, 'outputvoltcurr', 5, 1);
% Cleanup
disconnect(deviceObj);
delete(deviceObj);
|
|
Contact us at files@mathworks.com