The Instrument Control Toolbox™ software provides the means of communicating directly with a hardware instrument through an interface object. If you are programming directly through an interface object, you need to program with the command language of the instrument itself. Any substitution of instrument, such as make or model, may require a change to the appropriate the MATLAB® code.
A MATLAB instrument driver offers a layer of interpretation between you and the instrument. The instrument driver contains all the necessary commands for programming the instrument, so that you do not need to be aware of the specific instrument commands. Instead, you can program the instrument with familiar or consistent device object properties and functions.
The following figure shows how a device object and instrument driver offer a layer between the command line and the interface object. The instrument driver handles the instrument-level commands, so that as you program from the command line, you need only manipulate device object properties and functions, rather than instrument commands.
In addition to containing instrument commands, the instrument driver can also contain the MATLAB code to provide analysis based upon instrument setup or data.
Note: For many instruments, a MATLAB instrument driver already exists and you will not need to create a MATLAB instrument driver for your instrument. For other instruments, there may be a similar MATLAB instrument driver and you will need to edit it. If you would like more information on how to edit a MATLAB instrument driver, you may want to begin with Modifying MATLAB Instrument Drivers.
Note: The Instrument Driver Editor is unable to open MDDs with non-ascii characters either in their name or path on Mac platforms.
A MATLAB instrument driver contains information on the functionality supported by an instrument. You access this functionality through a device object's properties and functions.
When you query or configure a property of the device object
or when you call (
invoke) a function on the device
object, the MATLAB instrument driver provides a translation to
determine what instrument commands are written to the instrument or
what the MATLAB code is executed.
Using a MATLAB instrument driver isolates you from the instrument commands. Therefore, you do not need to be aware of the instrument syntax, but can use the same code for a variety of related instruments, ignoring the differences in syntax from one instrument to the next.
For example, suppose you have two different oscilloscopes in your shop, each with its own set of commands. If you want to perform the same tasks with the two different instruments, you can create an instrument driver for each scope so that you can control each with the same code. Then substitution of one instrument for another does not require a change in the MATLAB code being used to control it, but only a substitution of the instrument driver.