Main Content

Get Started with TCP/IP Socket Interface

Create VISA-Socket Object

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

visadev requires the resource name or alias as an input. The resource name consists of the name of the TCP/IP board index, IP address or host name, and port of your instrument. You can find the VISA-Socket 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-Socket resource name has the format TCPIP[board]::remote_host::port::SOCKET.

For example, use the VISA-Socket interface to connect to a Keysight™ N9010B EXA Signal Analyzer.

visasocket = visadev("TCPIP0::A-N9010B-21026.local::5005::SOCKET")
visasocket = 

  Socket with properties:

         ResourceName: "TCPIP0::A-N9010B-21026.local::5005::SOCKET"
                Alias: "SIGNAL_ANALYZER"
               Vendor: "Keysight"
                Model: "N9010B"
            IPAddress: "A-N9010B-21026.local"
                 Port: 5005
    NumBytesAvailable: 0

  Show all properties, functions

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

              ResourceName: "TCPIP0::A-N9010B-21026.local::5005::SOCKET"
                     Alias: "SIGNAL_ANALYZER"
                    Vendor: "Keysight"
                     Model: "N9010B"
                 IPAddress: "A-N9010B-21026.local"
                      Port: 5005
         NumBytesAvailable: 0

              SerialNumber: "314159265"
                      Type: socket
             PreferredVisa: "National Instruments VISA"

                 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