Query or read instrument data
Instrument Control Toolbox
The Query Instrument block configures and opens an interface to an instrument, initializes the instrument, and queries the instrument for data. The configuration and initialization happen at the start of the model execution. The block queries the instrument for data during model run time.
The block has no input ports. The block has one output port corresponding to the data received from the instrument.
The Block sample time parameter is the only setting outside
of the dialog box tabs. The default value is
Setting the value to
-1 sets the block to inherit
timing. A positive value is used as the sample period.
The Hardware Configuration tab is where you define the settings for communications with your instrument. You have two choices about establishing an interface:
Specify a new hardware configuration.
Use an interface object from the MATLAB® workspace.
The following figure shows the Hardware Configuration tab set to specify a new hardware configuration using a serial port interface.
Because some parameters apply to multiple interface types, they appear here in alphabetical order.
The rate at which bits are transmitted for the serial or VISA serial interface.
The index of the board used for GPIB, VISA GPIB, VISA TCPIP,
or VISA USB interface to the instrument. See
BoardIndex property for more information.
The vendor of the GPIB board used for the interface to the instrument. Your choices are Keysight™ (formerly Agilent®), ICS Electronics™, Measurement Computing™ (MCC), and National Instruments®.
The index number of the VXI chassis. Used for VISA VXI and VISA VXI-GPIB interface types.
The total number of bytes that can be stored in the software input buffer during a read operation.
Select the type of hardware interface to the instrument. Your options are those interfaces supported by the Instrument Control Toolbox™ software. The previous figure shows a configuration for a serial port interface.
The logical address of the VXI instrument. Used for VISA VXI and VISA VXI-GPIB interface types.
The manufacturer ID of the VISA USB instrument. See
ManufacturerID property for more information.
The model code of the VISA USB instrument. See
ModelCode property for more information.
The port for the serial interface: COM1, COM2, etc.
The primary address of the instrument on the GPIB.
The host name or IP address of the instrument. Used for UDP, TCPIP, or VISA TCPIP interface types.
The port on the instrument or remote host used for communication. Used for UDP, TCPIP, or VISA TCPIP interface types.
The secondary address of the instrument on the GPIB.
The serial number of the VISA USB instrument defined as a character
for more information.
Time in seconds allowed to complete the query operation.
The vendor of the VISA used for any of the VISA interface types. Your choices are Agilent, National Instruments, and Tektronix®.
Select this option to use an interface object from the MATLAB workspace.
Enter the object name that you want to use from the MATLAB workspace.
The Instrument Initialization tab is where you define what happens when you first open your connection to the instrument.
The default initialization option is none.
A string sent to the instrument as an instrument command to initialize the instrument or set it up in a known state.
Any function that has as its only argument the interface object representing the instrument. You can write this function to include several instrument commands and initialization data.
The Query tab is where you define the optional query command, set the format for the response, and define what the block does after the initial instrument response.
This is the query command that is sent to the instrument. It is usually a request for instrument status or data. This command is optional — if you are retrieving information or data from the instrument and no query command is necessary to do that, you can leave this field blank.
Your options are
Binblock (binary block — the
is described in the
Available only when the format is
this defines the format string for the data. For a list of formats,
Used for binary or binblock format. Your options are:
8-bit integer (default)
8-bit unsigned integer
16-bit unsigned integer
32-bit unsigned integer
When using binary or binblock format with more than 8 bits,
you can specify the instrument's byte order for the data. Your options
Big Endian or
Used for binary format. Specify the number of binary values to read from the instrument.
Select this option if you want to remove any additional bytes from the input buffer before querying.
This defines the action to take after the first response from the instrument. Your options are Repeat query for new data, Recycle original data, Hold final value, Output zero, or Stop simulation.
A frame is a sequence of samples combined into a single vector. In frame-based processing all the samples in a frame are processed simultaneously. In sample-based processing, samples are processed one at a time. The advantage of frame-based processing is that it can greatly increase the speed of a simulation. For example, you might use frames if you are reading a waveform from your instrument rather than a single-point measurement.
Frame size determines the number of samples in a frame.
Note Hardware information shown in the dialog box is determined and cached when you first open the dialog box. To refresh the display with new values, restart MATLAB.