Main Content

Get Started with GPIB Interface

You can communicate with GPIB instruments in MATLAB® by using the VISA-GPIB interface.

Install Required Drivers

In order to use the VISA-GPIB interface, you must have the required drivers installed for both GPIB and VISA. The VISA-GPIB interface is supported on Windows® 10 and not available for macOS or Linux.

The following table shows the minimum GPIB and VISA driver versions you must have. You must have one of the following GPIB drivers and its corresponding VISA driver both installed.

Minimum GPIB driverMinimum VISA driver
Keysight® IO Libraries version 18.1.24715.0 (Keysight Connection Expert 2019)Keysight IO Libraries version 18.1.24715.0 (Keysight Connection Expert 2019)
ICS 488.2v4 Adaptor version 4.0
ADLINK ADL-GPIB version 20.01.0
NI-488.2 Adaptor v2.8

National Instruments™ NI-VISA version 19.5

MCC GPIB 488.2 Library v2.3

Create VISA-GPIB Object

Create a VISA-GPIB object with the visadev function. Each VISA-GPIB object is associated with:

  • A GPIB controller installed in your computer

  • An instrument with a GPIB interface

visadev requires the resource name or alias as an input. 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 or alias for a given instrument with the configuration tool provided by your vendor or with the visadevlist function. Define the alias using your VISA vendor configuration tool.

The VISA-GPIB resource name has the format GPIB[board]::primary_address[::secondary_address]::INSTR.

For example, use the VISA-GPIB interface to connect to a National Instruments controller with board index 0 and a Tektronix® TDS1002 digital oscilloscope with primary address 1 and secondary address 0.

visagpib = visadev("GPIB0::1::0::INSTR")
visagpib = 

  GPIB with properties:

         ResourceName: "GPIB0::1::0::INSTR"
                Alias: "OSCOPE_2CH"
               Vendor: "TEKTRONIX"
                Model: "TDS 1002"
           BoardIndex: 0
       PrimaryAddress: 1
     SecondaryAddress: 0

  Show all properties, functions

The VISA-GPIB object visagpib represents a connection to your instrument. Click properties in the object display to see a full list of VISA-GPIB properties.

              ResourceName: "GPIB0::1::0::INSTR"
                     Alias: "OSCOPE_2CH"
                    Vendor: "TEKTRONIX"
                     Model: "TDS 1002"
                BoardIndex: 0
            PrimaryAddress: 1
          SecondaryAddress: 0

              SerialNumber: "0"
                      Type: gpib
             PreferredVisa: "National Instruments VISA"

                 ByteOrder: "little-endian"
                   Timeout: 10
                Terminator: "LF"
                   EOIMode: on

           NumBytesWritten: 0

          ErrorOccurredFcn: []
                  UserData: []

You can use dot notation to configure and display property values. For more information about configuring these properties, see visadev Properties.

You can communicate with your instrument using the visadev Object Functions.

See Also


Related Topics