Working with the TCP/IP Interface for VXI-11 and HiSLIP

Understanding VISA-TCP/IP

The TCP/IP interface is supported through a VISA-TCP/IP object. The features associated with a VISA-TCP/IP object are similar to the features associated with a tcpip object. Therefore, only functions and properties that are unique to VISA's TCP/IP interface are discussed in this section. Both VXI-11 and HiSLIP protocols are supported.

Refer to TCP/IP and UDP Comparison to learn about writing and reading text and binary data, using events and callbacks, and so on.

Creating a VISA-TCPIP Object

You create a VISA-TCPIP object with the visa function. Each VISA-TCPIP object is associated with an instrument connected to your computer.

visa requires the vendor name and the resource name as input arguments. The vendor name can be keysight (note that agilent also still works), ni, rs, or tek. The resource name consists of the TCP/IP board index, IP address or host name, and LAN device name of your instrument. You can find the VISA-TCPIP 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 property values 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 the resource string and create the object using that information. For example, to create a VISA-TCPIP object that uses National Instruments® VISA associated with an instrument at IP address 216.148.60.170 using the VXI-11 protocol,

vt = visa('ni','TCPIP::216.148.60.170::INSTR');

The VISA-TCPIP object vt now exists in the MATLAB® workspace.

To open an connection to the instrument, type:

fopen (vt);

You can display the class of vt with the whos command.

whos vt
  Name      Size         Bytes  Class

  vt        1x1            886  visa object

Grand total is 17 elements using 886 bytes

After you create the VISA-TCPIP object, the properties listed below are automatically assigned values. These properties provide descriptive information about the object based on its class type and address information.

VISA-TCPIP Descriptive Properties

Property Name

Description

Name

Specify a descriptive name for the VISA-TCPIP object.

RsrcName

Indicate the resource name for a VISA instrument.

Type

Indicate the object type.

You can display the values of these properties for vt.

vt.Name
ans = 
VISA-TCPIP-216.148.60.170
vt.RsrcName
ans = 
TCPIP::216.148.60.170::INSTR
vt.Type
ans = 
visa-tcpip

VISA-TCPIP Object Display

The VISA-TCPIP object provides you with a convenient display that summarizes important address and state information. You can invoke the display summary these three ways:

  • Type the VISA-TCPIP object at the command line.

  • Exclude the semicolon when creating a VISA-TCPIP object.

  • Exclude the semicolon when configuring properties using the 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-TCPIP object vt is given below.

VISA-TCPIP Object Using NI Adaptor : VISA-TCPIP-216.148.60.170

Communication Address
   RemoteHost:         216.148.60.170

Communication State
   Status:             closed
   RecordStatus:       off  

Read/Write State
   TransferStatus:     idle
   BytesAvailable:     0
   ValuesReceived:     0
   ValuesSent:         0

VISA-TCPIP Address

The VISA-TCPIP address consists of

  • Board index (optional, from the VISA configuration)

  • Remote host of the instrument

  • The protocol, either VXI-11 or HiSLIP

  • LAN device name of the instrument (optional)

You specify these address property values via the resource name during VISA-TCPIP object creation. The instrument address properties are given below.

VISA-TCPIP Address Properties

Property Name

Description

BoardIndex

Specify the index number of the TCP/IP board in VISA configuration (optional — defaults to 0).

RemoteHost

Specify the remote host name or IP address of the instrument.

LANName

Specify the LAN device name of the instrument.

The properties are automatically updated with the specified resource name values when you create the VISA-TCPIP object.

You can display the address property values for the VISA-TCPIP object vt, created in Creating a VISA-TCPIP Object.

fopen(vt)
vt.RemoteHost
ans = 
    216.148.60.170