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 .
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.
ensure all necessary software is installed. see prerequisites for the list.
ensure that your instrument is recognized by the visa utility. in this case, open keysight connectivity expert and make sure it recognizes the oscilloscope.
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 .
connect to the instrument.
dev = ividev("iviscope","myscope","idquery",true,"resetdevice",true);
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");
after configuring the instrument and retrieving its data, close the session and remove it from the workspace.
clear dev
see also
|