Main Content

Device Objects

Overview

All instruments attached to your computer must communicate through an interface. Popular interface protocols include GPIB, VISA, RS-232 (serial), and RS-485 (serial). While Instrument Control Toolbox™ interface objects allow you to communicate with your equipment at a low (instrument command) level, Instrument Control Toolbox also allows you to communicate with your equipment without detailed knowledge of how the hardware interface operates.

Programmable devices understand a specific language, sometimes referred to as its command set. One common set is called SCPI (Standard Commands for Programmable Instruments).

Device objects allow you to configure and query an instrument without knowledge of its command set. This section covers the basic functionality of device objects that use MATLAB® instrument drivers.

If your application is straightforward, or if you are already familiar with the topics mentioned above, you might want to begin with Creating and Connecting Device Objects. If you want a high-level description of all the steps you are likely to take when communicating with your instrument, refer to the Getting Started documentation that is linked to from the top of the main Instrument Control Toolbox Doc Center page.

What Are Device Objects?

Device objects are used to represent instruments in MATLAB workspace. Properties and methods specific to an instrument are encapsulated within device objects. Device objects also free you from the specific underlying commands required to communicate with your hardware.

You can use device objects at the MATLAB Command Window, inside functions, scripts, and graphical user interface callbacks. The low-level communication is performed through a MATLAB instrument driver.

Diagram that shows the different components of communicating with an instrument using MATLAB.

Device Objects for MATLAB Instrument Drivers

There are three types of MATLAB instrument drivers:

  • MATLAB interface instrument driver

  • MATLAB IVI® instrument driver

  • MATLAB VXIplug&play instrument driver

  • Generic instrument driver

Instrument Control Toolbox device objects support all these types of MATLAB drivers, so that by using a device object, you can interface with any of these drivers in the same way. However, each of these drivers interfaces differently with the hardware. While MATLAB IVI and MATLAB VXIplug&play drivers interface directly through standard drivers and the hardware port to the instrument, the MATLAB interface driver requires an interface object to communicate with the instrument. You can use generic drivers to communicate with devices or software. For more information on generic drivers, see Generic Drivers: Overview.

The Instrument Control Toolbox software supports the following interface objects:

  • gpib

  • serial

  • tcpip

  • udp

  • visa

To learn how to create and use interface objects, see Create Interface Object.

Note

If you are using an interface object with a device object and a MATLAB interface driver, you do not need to connect the interface object to the interface using the fopen command. You need to connect the device object only.

Available MATLAB Instrument Drivers

Several drivers ship with the Instrument Control Toolbox software. You can find these drivers by looking in the directory

matlabroot\toolbox\instrument\instrument\drivers

where matlabroot is the MATLAB installation directory, as seen when you type

matlabroot

at the MATLAB Command Window.

Many other drivers are available on the MathWorks Web site at

including drivers specifically for the Instrument Control Toolbox software.