visa
(To be removed) Create VISA object
visa
will be removed in a future release. Use visadev
instead. For more information on updating your code, see
Compatibility Considerations.
Syntax
obj = visa('
vendor
','rsrcname')
Arguments
| A supported VISA vendor. |
| The resource name of the VISA instrument. |
| A VISA property name. |
| A property value supported by
|
| The VISA object. |
Description
obj = visa('
creates the VISA object vendor
','rsrcname')obj
with a resource name given by
rsrcname
for the vendor specified by
vendor
.
You must first configure your VISA resources in the vendor's tool first, and then
you create these VISA objects. Use instrhwinfo
to find the
commands to configure the objects:
vinfo = instrhwinfo('visa','keysight'); vinfo.ObjectConstructorName
If an invalid vendor or resource name is specified, an error is returned and the
VISA object is not created. For a list of supported values for
vendor
see Supported Vendor and Resource
Names.
Examples
Create a VISA-serial object connected to serial port COM1 using National Instruments™ VISA interface.
vs = visa('ni','ASRL1::INSTR');
Create a VISA-GPIB object connected to board 0 with primary address 1 and secondary address 30 using Keysight™ VISA interface.
vg = visa('keysight','GPIB0::1::30::INSTR');
Create a VISA-VXI object connected to a VXI instrument located at logical address 8 in the first VXI chassis.
vv = visa('keysight','VXI0::8::INSTR');
Create a VISA-GPIB-VXI object connected to a GPIB-VXI instrument located at logical address 72 in the second VXI chassis.
vgv = visa('keysight','GPIB-VXI1::72::INSTR');
Create a VISA-RSIB object connected to an instrument configured with IP address 192.168.1.33.
vr = visa('ni', 'RSIB::192.168.1.33::INSTR')
Create a VISA-TCPIP object connected to an instrument configured with IP address 216.148.60.170.
vt = visa('tek', 'TCPIP::216.148.60.170::INSTR')
Create a VISA-USB object connected to a USB instrument with manufacturer ID 0x1234, model code 125, and serial number A22-5.
vu = visa('keysight', 'USB::0x1234::125::A22-5::INSTR')
Tips
At any time, you can use the instrhelp
function to view a
complete listing of properties and functions associated with VISA objects.
instrhelp visa
You can specify the property names and property values using any format supported
by the set
function. For example, you
can use property name/property value cell array pairs. Additionally, you can specify
property names without regard to case, and you can make use of property name
completion. For example, the following commands are all valid.
v = visa('ni','GPIB0::1::INSTR','SecondaryAddress', 96); v = visa('ni','GPIB0::1::INSTR','secondaryaddress', 96); v = visa('ni','GPIB0::1::INSTR','SECOND', 96);
Before you can communicate with the instrument, it must be connected to
obj
with the fopen
function. A connected
VISA object has a Status
property value of
open
. An error is returned if you attempt a read or write
operation while obj
is not connected to the instrument. You
cannot connect multiple VISA objects to the same instrument.
Creating a VISA-GPIB Object
When you create a VISA-GPIB object, these properties are automatically configured:
Type
is given byvisa-gpib
.Name
is given by concatenatingVISA-GPIB
with the board index, the primary address, and the secondary address.BoardIndex
,PrimaryAddress
,SecondaryAddress
, andRsrcName
are given by the values specified during object creation.
Creating a VISA-GPIB-VXI Object
When you create a VISA-GPIB-VXI object, these properties are automatically configured:
Type
is given byvisa-gpib-vxi
.Name
is given by concatenatingVISA-GPIB-VXI
with the chassis index and the logical address specified in thevisa
function.ChassisIndex
,LogicalAddress
, andRsrcName
are given by the values specified during object creation.BoardIndex
,PrimaryAddress
, andSecondaryAddress
are given by thevisa
driver after the object is connected to the instrument withfopen
.
Creating a VISA-RSIB Object
When you create a VISA-RSIB object, these properties are automatically configured:
Type
is given byvisa-rsib
.Name
is given by concatenatingVISA-RSIB
with the remote host specified in thevisa
function.RemoteHost
andRsrcName
are given by the values specified during object creation.
Creating a VISA-Serial Object
When you create a VISA-serial object, these properties are automatically configured:
Type
is given byvisa-serial
.Name
is given by concatenatingVISA-Serial
with the port specified in thevisa
function.Port
andRsrcName
are given by the values specified during object creation.
Creating a VISA-TCPIP Object
When you create a VISA-TCPIP object, these properties are automatically configured:
Type
is given byvisa-tcpip
.Name
is given by concatenatingVISA-TCPIP
with the board index, remote host, and LAN device name specified in thevisa
function.BoardIndex
,RemoteHost
,LANNAme
, andRsrcName
are given by the values specified during object creation.
Creating a VISA-USB Object
When you create a VISA-USB object, these properties are automatically configured:
Type
is given byvisa-usb
.Name
is given by concatenatingVISA-USB
with the board index, manufacturer ID, model code, serial number, and interface number specified in thevisa
function.BoardIndex
,ManufacturerID
,ModelCode
,SerialNumber
,InterfaceIndex
, andRsrcName
are given by the values specified during object creation.
Creating a VISA-VXI Object
When you create a VISA-VXI object, these properties are automatically configured:
Type
is given byvisa-vxi
.Name
is given by concatenatingVISA-VXI
with the chassis index and the logical address specified in thevisa
function.ChassisIndex
,LogicalAddress
, andRsrcName
are given by the values specified during object creation.
Version History
Introduced before R2006aSee Also
visadev
| fclose
| fopen
| instrhwinfo
| BoardIndex
| ChassisIndex
| InterfaceIndex
| LANName
| LogicalAddress
| ManufacturerID
| ModelCode
| Name
| Port
| PrimaryAddress
| RsrcName
| SecondaryAddress
| SerialNumber
| Status
| Type