Communicating with Your Instrument
Interface Objects and Instrument Commands
Communicating with your instrument involves sending and receiving commands, settings, responses, and data. The level of communication depends on the type of instrument object you use.
To communicate through the interface object, you need to send
instrument commands, and you receive information as the instrument
sends it. Therefore, you have to know the syntax specific to the instrument
itself. For example, if the instrument requires the command '*RST'
to
initiate its action, then that is exactly the command that must be
sent to the interface object.
Text commands and binary data are sent directly to the instrument
and received from the instrument with such functions as fprintf
, fwrite
, fgets
, fread
,
and others.
Device Objects and Instrument Drivers
To communicate through a device object, you access object properties
with the set
and get
commands, and you execute driver
functions with the invoke
command.
The invoke
command for a device object employs
methods and arguments defined by the instrument driver. So using device
objects does not require you to use instrument-specific commands and
syntax.
For information on creating, editing, and importing instrument drivers, see MATLAB Instrument Driver Editor Overview.