Instrument Control Toolbox    
visa

Create a VISA object

Syntax

Arguments

'vendor'
A supported VISA vendor.
'rsrcname'
The resource name of the VISA instrument.
'PropertyName'
A VISA property name.
PropertyValue
A property value supported by PropertyName.
obj
The VISA object.

Description

obj = visa('vendor','rsrcname') creates the VISA object obj with a resource name given by rsrcname for the vendor specified by vendor. If an invalid vendor or resource name is specified, an error is returned and the VISA object is not created. The supported values for vendor are given below.

Vendor
Description
agilent
Agilent Technologies VISA
ni
National Instruments VISA
tek
Tektronix VISA

The format for rsrcname is given below for the supported VISA interfaces. The values indicated by brackets are optional.

Interface
Resource Name
GPIB
GPIB[board]::primary_address::[secondary_address]::INSTR
VXI
VXI[chassis]::VXI_logical_address::INSTR
GPIB-VXI
GPIB-VXI[chassis]::VXI_logical_address::INSTR
RSIB
RSIB::remote_host::INSTR (provided by NI VISA only)
Serial
ASRL[port_number]::INSTR

The rsrcname parameters are described below.

Parameter
Description
board
Board index (optional - defaults to 0)
chassis
VXI chassis index (optional - defaults to 0)
port_number
Serial port number (optional - defaults to 1)
primary_address
Primary address of the GPIB instrument
remote_host
Host name or IP address of the instrument.
secondary_address
Secondary address of the GPIB instrument (optional - defaults to 0)
VXI_logical_address
Logical address of the VXI instrument

obj = visa('vendor','rsrcname','PropertyName',PropertyValue,...) creates the VISA object with the specified property names and property values. If an invalid property name or property value is specified, an error is returned and the VISA object is not created.

Remarks

At any time, you can use the instrhelp function to view a complete listing of properties and functions associated with VISA objects.

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.

Before you can communicate with the instrument, it must be connected to obj with the fopen function. A connected instrument 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:

Creating a VISA-VXI Object

When you create a VISA-VXI object, these properties are automatically configured:

Creating a VISA-GPIB-VXI Object

When you create a VISA-GPIB-VXI object, these properties are automatically configured:

Creating a VISA-Serial Object

When you create a VISA-serial object, these properties are automatically configured:

Example

Create a VISA-serial object connected to serial port COM1 using National Instruments VISA interface.

Create a VISA-GPIB object connected to board 0 with primary address 1 and secondary address 30 using Agilent Technologies VISA interface.

Create a VISA-VXI object connected to a VXI instrument located at logical address 8 in the first VXI chassis.

Create a VISA-GPIB-VXI object connected to a GPIB-VXI instrument located at logical address 72 in the second VXI chassis.

See Also

Functions

fclose, fopen, instrhelp, instrhwinfo

Properties

BoardIndex, ChassisIndex, LogicalAddress, Name, Port, PrimaryAddress, RsrcName, SecondaryAddress, Status, Type


  udp Property Reference