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 GPIB Overview to learn about the GPIB interface, writing and reading text and binary data, using events and callbacks, using triggers, and so on.
The VISA-GPIB object does not support the
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
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:
You can then display the class of
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
Specify a descriptive name for the VISA-GPIB object.
Indicate the resource name for a VISA instrument.
Indicate the object type.
You can display the values of these properties for
vg.Name ans = 'VISA-GPIB0-1'
vg.RsrcName ans = 'GPIB0::1::0::INSTR'
vg.Type ans = '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
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
Specify the index number of the GPIB board.
Specify the primary address of the GPIB instrument.
Specify the secondary address of the GPIB instrument.
You can display the address property values for the VISA-GPIB
vg created in Creating a VISA-GPIB Object .
vg.BoardIndex ans = 0
vg.PrimaryAddress ans = 1
vg.SecondaryAddress ans = 0