You create a VISA-USB object with the
visa function. Each VISA-USB object
is associated with an instrument connected to a USB port on your computer.
visa requires the vendor name and the resource name as input arguments. The
vendor name can be
keysight (note that
also still works),
tek. The resource name consists of the USB board index,
manufacturer ID, model code, serial number, and interface number of the connected
instrument. You can find the VISA-USB 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-USB object that uses National Instruments® VISA,
vu = visa('ni','USB::0x1234::125::A22-5::INSTR');
The VISA-USB object
vu now exists in the MATLAB® workspace.
To open a connection to the instrument, type:
You can display the class of
vu with the
whos vu Name Size Bytes Class vu 1x1 882 visa object Grand total is 15 elements using 882 bytes
After you create the VISA-USB 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-USB Descriptive Properties
You can display the values of these properties for
vu.Name ans = VISA-USB-0-0x1234-125-A22-5-0
vu.RsrcName ans = USB::0x1234::125::A22-5::INSTR
vu.Type ans = visa-usb
The VISA-USB 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-USB object at the command line.
Exclude the semicolon when creating a VISA-USB 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-USB object
VISA-USB Object Using NI Adaptor : VISA-USB-0-0x1234-125-A22-5-0 Communication Address ManufacturerID: 0x1234 ModelCode: 125 SerialNumber: A22-5 Communication State Status: closed RecordStatus: off Read/Write State TransferStatus: idle BytesAvailable: 0 ValuesReceived: 0 ValuesSent: 0
The VISA-USB address consists of
Board index (optional, from the VISA configuration)
Manufacturer ID of the instrument
Model code of the instrument
Serial number of the instrument
Interface number (optional, from the VISA configuration)
You specify these address property values via the resource name during VISA-USB object creation. The instrument address properties are given below.
VISA-USB Address Properties
Specify the index number of the USB board in VISA configuration (optional — defaults to 0).
Specify the USB interface number (optional).
Specify the manufacturer ID of the USB instrument.
Specify the model code of the USB instrument.
Specify the index of the USB instrument on the USB hub.
The properties are automatically updated with the specified resource name values when you create the VISA-USB object.
You can display the address property values for the VISA-USB
vu, created in Creating a VISA-USB Object.
fopen(vu) vu.ManufacturerID ans = 0x1234
vu.ModelCode ans = 125
vu.SerialNumber ans = A22-5