Main Content

Get Started with the USB Interface

Create a VISA-USB Object

Create a VISA-USB object with the visadev function. Each object is associated with an instrument connected to a USB port on your computer.

visadev requires the resource name or alias as an input. The resource name consists of the name of the USB board index, vendor ID, product ID, serial number, and interface number of the connected instrument. You can find the VISA-USB 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-USB resource name has the format USB[board]::vendor_ID::product_ID::serial_number[::interface_number]::INSTR.

For example, use the VISA-USB interface to connect to a Tektronix® TDS2024B digital oscilloscope.

visausb = visadev("USB0::0x0699::0x036A::CU010105::0::INSTR")
visausb = 

  USB with properties:

         ResourceName: "USB0::0x0699::0x036A::CU010105::0::INSTR"
                Alias: "NI_SCOPE_4CH"
               Vendor: "TEKTRONIX"
                Model: "TDS 2024B"
    NumBytesAvailable: 0

  Show all properties, functions

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

              ResourceName: "USB0::0x0699::0x036A::CU010105::0::INSTR"
                     Alias: "NI_SCOPE_4CH"
                    Vendor: "TEKTRONIX"
                     Model: "TDS 2024B"
         NumBytesAvailable: 0

                      Type: usb
             PreferredVisa: "National Instruments VISA"

                  VendorID: "0x0699"
                 ProductID: "0x036A"
              SerialNumber: "CU010105"
                BoardIndex: 0
            InterfaceIndex: 0

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

     BytesAvailableFcnMode: "off"
    BytesAvailableFcnCount: 64
         BytesAvailableFcn: []
           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