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
Refer to TCP/IP and UDP Comparison to learn about writing and reading text and binary data, using events and callbacks, and so on.
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),
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 22.214.171.124 using the VXI-11 protocol,
vt = visa('ni','TCPIP::126.96.36.199::INSTR');
The VISA-TCPIP object
exists in the MATLAB® workspace.
To open an connection to the instrument, type:
can display the class of
vt with the
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
You can display the values of these properties for
vt.Name ans = VISA-TCPIP-188.8.131.52
vt.RsrcName ans = TCPIP::184.108.40.206::INSTR
vt.Type ans = visa-tcpip
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
VISA-TCPIP Object Using NI Adaptor : VISA-TCPIP-220.127.116.11 Communication Address RemoteHost: 18.104.22.168 Communication State Status: closed RecordStatus: off Read/Write State TransferStatus: idle BytesAvailable: 0 ValuesReceived: 0 ValuesSent: 0
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
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
vt, created in Creating a VISA-TCPIP Object.
fopen(vt) vt.RemoteHost ans = 22.214.171.124