Description

obj = icdevice('driver', hwobj) creates
the device object obj. The instrument-specific
information is defined in the MATLAB interface instrument driver, driver.
Communication to the instrument is done through the interface object, hwobj.
The interface object can be a serial port, GPIB, VISA, TCPIP, or UDP
object. If driver does not exist or if hwobj is
invalid, the device object is not created.

Device objects may also be used with VXIplug&play and
Interchangeable Virtual Instrument (IVI®) drivers. To use these
drivers, you must first have a MATLAB instrument driver wrapper
for the underlying VXIplug&play or IVI driver.
If the MATLAB instrument driver wrapper does not already exist,
it may be created using makemid or midedit. Note that makemid or midedit only
needs to be used once to create the MATLAB instrument driver
wrapper.

obj = icdevice('driver', 'RsrcName') creates
a device object obj, using the MATLAB instrument
driver, driver. The specified driver must
be a MATLAB VXIplug&play instrument
driver or MATLAB IVI instrument driver. Communication to
the instrument is done through the resource specified by rsrcname.
For example, all VXIplug&play, and many IVI drivers
require VISA resource names for rsrcname.

obj = icdevice('driver') constructs
a device object obj, using the MATLAB instrument
driver, driver. The specified driver must
be a MATLAB IVI instrument driver, and the underlying IVI driver
must be referenced using a logical name.

On all supported platforms, a file with the name MATLABPrototypeFor<driverName>.m is
generated, where <driverName> the name of
the IVI-C or VXI Plug&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. If using the icdevice function,
remember to also manually include the MDD-file in the deployed application
or shared library. For more information on including additional files
refer to the MATLAB Compiler documentation.

Examples

The first example creates a device object for a Tektronix® TDS
210 oscilloscope that is connected to a MCC GPIB board, using a MATLAB interface
object and MATLAB interface instrument driver.

g = gpib('mcc',0,2);
d = icdevice('tektronix_tds210',g);

Connect to the instrument.

connect(d);

List the oscilloscope settings that can be configured.

props = set(d);

Get the current configuration of the oscilloscope.

values = get(d);

Disconnect from the instrument and clean
up.

disconnect(d);
delete([d g]);

The second example creates a device object for a Tektronix TDS
210 oscilloscope using a MATLAB VXIplug&play instrument
driver.

This example assumes that the 'tktds5k' VXIplug&play driver
is installed on your system.

This first step is necessary only if a MATLAB VXIplug&play instrument
driver for the tktds5k does not exist on your system.

makemid('tktds5k', 'Tktds5kMATLABDriver');

Construct a device object that uses the VXIplug&play driver.
The instrument is assumed to be located at GPIB primary address 2.

d = icdevice('Tktds5kMATLABDriver', 'GPIB0::2::INSTR');

Connect to the instrument.

connect(d);

List the oscilloscope settings that can be configured.

props = set(d);

Get the current configuration of the oscilloscope.

values = get(d);

Disconnect from the instrument and clean up.

disconnect(d);
delete(d);

Tips

At any time, you can use the instrhelp function
to view a complete listing of properties and functions associated
with device objects.

instrhelp icdevice

When you create a device object, these property values are automatically
configured:

Interface specifies the interface
used to communicate with the instrument. For device objects created
using interface objects, it is that interface object. For VXIplug&play and
IVI-C, this is the session handle to the driver session. For MATLAB instrument
drivers, this is the handle to the driver's default COM interface.

LogicalName is an IVI logical
name. For non-IVI drivers, it is empty.

Name is given by concatenating
the instrument type with the name of the instrument driver.

RsrcName is the full VISA resource
name for VXIplug&play and IVI drivers.
For MATLAB interface drivers, RsrcName is
an empty character vector.

Type is the instrument type,
if known (for example, scope or multimeter).

To communicate with the instrument, the device object must be
connected to the instrument with the connect function.
When the device object is constructed, the object's Status property
is closed. Once the device object is connected
to the instrument with the connect function,
the Status property is configured to open.

Note

ICDEVICE is unable to open MDDs with non-ascii characters either
in their name or path on Mac platforms.

Note

To get a list of options you can use on a function, press the Tab key
after entering a function on the MATLAB command line. The list
expands, and you can scroll to choose a property or value. For information
about using this advanced tab completion feature, see Using Tab Completion for Functions.