| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Instrument Control Toolbox |
| Contents | Index |
| Learn more about Instrument Control Toolbox |
| On this page… |
|---|
The GPIB interface is supported through a VISA-GPIB object. The features associated with a VISA-GPIB object are similar to the features associated with a GPIB object. Therefore, only functions and properties that are unique to VISA's GPIB interface are discussed in this section.
Refer to Controlling Instruments Using GPIB, to learn about the GPIB interface, writing and reading text and binary data, using events and callbacks, using triggers, and so on.
Note The VISA-GPIB object does not support the spoll function, or the BusManagementStatus, CompareBits, and HandshakeStatus properties. |
You create a VISA-GPIB object with the visa function. Each VISA-GPIB object is associated with
A GPIB controller installed in your computer
An instrument with a GPIB interface
visa requires the vendor name and the resource name as input arguments. The vendor name can be agilent, ni, or tek. The resource name consists of the GPIB board index, the instrument primary address, and the instrument secondary address. You can find the VISA-GPIB resource name for a given instrument with the configuration tool provided by your vendor, or with the instrhwinfo function. (In place of the resource name, you can use an alias as defined with your VISA vendor configuration tool.) As described in Connecting to the Instrument, you can also configure properties during object creation.
Before you create a VISA object, you must find the instrument in the appropriate vendor VISA explorer. When you find the instrument configured, note its VISA resource string and create the object using that information.
For example, to create a VISA-GPIB object associated with a National Instruments controller with board index 0, and a Tektronix TDS 210 digital oscilloscope with primary address 1 and secondary address 0,
vg = visa('ni','GPIB0::1::0::INSTR');The VISA-GPIB object vg now exists in the MATLAB workspace.
To open a connection to the instrument type:
fopen (vg);
You can then display the class of vg with the whos command.
whos vg Name Size Bytes Class vg 1x1 884 visa object Grand total is 16 elements using 884 bytes
After you create the VISA-GPIB object, the following properties are automatically assigned values. These properties provideinformation about the object based on its class type and address information.
VISA-GPIB Descriptive Properties
Property Name | Description |
|---|---|
Name | Specify a descriptive name for the VISA-GPIB object. |
RsrcName | Indicate the resource name for a VISA instrument. |
Type | Indicate the object type. |
You can display the values of these properties for vg with the get function.
get(vg,{'Name','RsrcName','Type'})
ans =
'VISA-GPIB0-1' 'GPIB0::1::0::INSTR' 'visa-gpib'The VISA-GPIB object provides a convenient display that summarizes important address and state information. You can invoke the display summary as follows:
Type the VISA-GPIB object at the command line.
Exclude the semicolon when creating a VISA-GPIB object.
Exclude the semicolon when configuring properties using dot notation.
You can also display summary information via the Workspace browser by right-clicking an instrument object and selecting Display Summary from the context menu.
The display summary for the VISA-GPIB object vg is given below.
VISA-GPIB Object Using NI Adaptor : VISA-GPIB0-1 Communication Address BoardIndex: 0 PrimaryAddress: 1 SecondaryAddress: 0 Communication State Status: closed RecordStatus: off Read/Write State TransferStatus: idle BytesAvailable: 0 ValuesReceived: 0 ValuesSent: 0
The VISA-GPIB address consists of
The board index of the GPIB controller installed in your computer.
The primary address and secondary address of the instrument. Valid primary addresses range from 0 to 30. Valid secondary addresses range from 0 to 30, where the value 0 indicates that the secondary address is not used.
You must specify the primary address value via the resource name during VISA-GPIB object creation. Additionally, you must include the board index and secondary address values as part of the resource name if they differ from the default value of 0.
The properties associated with the GPIB address are given below.
VISA-GPIB Address Properties
Property Name | Description |
|---|---|
BoardIndex | Specify the index number of the GPIB board. |
PrimaryAddress | Specify the primary address of the GPIB instrument. |
SecondaryAddress | Specify the secondary address of the GPIB instrument. |
The BoardIndex, PrimaryAddress, and SecondaryAddress properties are automatically updated with the specified resource name values when you create the VISA-GPIB object.
You can display the address property values for the VISA-GPIB object vg created in Creating a VISA-GPIB Object with the get function.
get(vg,{'BoardIndex','PrimaryAddress','SecondaryAddress'})
ans =
[0] [1] [0]
![]() | VISA Overview | Working with the VXI Interface | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |