Addressing a Session

As shown in the previous section, the rsrcName parameter in the viOpen function is used to identify a specific resource. This parameter consists of the VISA interface ID and the resource address. The interface ID is usually the VISA interface type followed by a number. For Keysight interfaces, you can change the VISA interface ID in Connection Expert.

The following table illustrates the format of the rsrcName for different VISA interface types. INSTR is an optional parameter that indicates that you are communicating with a resource that is of type INSTR, meaning instrument. The keywords are:

  • ASRL - used for asynchronous serial devices.
  • GPIB - used for GPIB devices and interfaces.
  • GPIB-VXI - used for GPIB-VXI controllers. (Windows only)
  • PXI - used for  modular instruments. (Windows only)
  • TCPIP - used for LAN and HiSLIP instruments.
  • VXI - used for VXI instruments. (Windows only)
  • USB - used for USB instruments.

Interface

Typical Syntax (see above for operating system-specific support)

ASRL

ASRL[board][::INSTR]

GPIB

GPIB[board]::primary address[::secondary address][::INSTR]

GPIB

GPIB[board]::INTFC

GPIB-VXI

GPIB-VXI[board]::VXI logical address[::INSTR]

GPIB-VXI

GPIB-VXI[board]::MEMACC

GPIB-VXI

GPIB-VXI[board][::VXI logical address]::BACKPLANE

PXI

PXI[bus]::device[::function][::INSTR]

PXI

PXI[interface]::bus-device[.function][::INSTR]

PXI

PXI[interface]::CHASSISchassis::SLOTslot[::FUNCfunction][::INSTR]

PXI

PXI[interface]::MEMACC

PXI

PXI[interface]::chassis number::BACKPLANE

TCPIP

TCPIP[board]::host address[::LAN device name]::INSTR

TCPIP

TCPIP[board]::[[$[$]][credential information]@]host address[::HiSLIP device name[,HiSLIP port]][::INSTR]

TCPIP

TCPIP[board]::[[$[$]][credential information]@]host address::port::SOCKET

USB

USB[board]::manufacturer ID::model code::serial number[::USB interface number][::INSTR]

VXI

VXI[board]::VXI logical address[::INSTR]

VXI

VXI[board]::MEMACC

VXI

VXI[board][::VXI logical address]::BACKPLANE

The following table describes the parameters shown in the table above.

Parameter

Description

board

This optional parameter is used if you have more than one interface of the same type. The default value for board is 0.

bus

PCI bus number.

chassis

Chassis number.

device

PCI device number.

function

This optional parameter is the PCI function number. The default value for function is 0.

host address

A hostname or a dot-delimited IPv4 IP address for TCPIP. The IP address (in dot-delimited decimal notation) or the name of the host computer/gateway. For the HiSLIP and Raw Sockets protocols only, the host address can be an IPv6 address in square brackets, [fe80::218:e77f] for example.

HiSLIP device name

The assigned name for the HiSLIP device (the name must begin with hislip). Only address strings specifically requesting a HiSLIP connection via the HiSLIP device name will get a HiSLIP connection.The default HiSLIP device name is hislip0.

HiSLIP port

The port number to use for a HiSLIP connection. The default is 4880.

interface

This optional parameter is used if you have more than one interface of the same type. The default value for interface is 0. In a system where all PCI devices are accessible through a single configuration address space, the standard requires that the interface parameter shall be 0 for all resources.

LAN device name

The assigned name for a LAN device.  Device name depends on LAN Host Device (see documentation that came with your LAN Host device, such as E5810). The default is inst0.

manufacturer ID

Manufacturer’s ID for a USB Test & Measurement-class device

model code

Model code of a USB device.

port

The port number to use for a TCP/IP socket connection.

primary address

The primary address of the GPIB device.

secondary address

This optional parameter is the secondary address of the GPIB device. If no secondary address is specified, none is assumed.

serial number

Serial number of a USB device.

slot

Slot number of the resource.

USB interface number

Interface number of a USB device. If no USB interface number is specified, the lowest-numbered relevant interface is assumed.

VXI logical address

Logical address of a VXI instrument within a mainframe.

Some examples of valid VISA addresses follow.

Address String

Description

VXI0::1::INSTR

A VXI device at logical address 1 in VXI interface VXI0.

GPIB-VXI::9::INSTR

A VXI device at logical address 9 in a GPIB-VXI controlled VXI system.

GPIB::1::0::INSTR

A GPIB device at primary address 1 and secondary address 0 in GPIB interface 0.

ASRL1::INSTR

A serial device located on port 1.

VXI::MEMACC

Board-level register access to the VXI interface.

GPIB-VXI1::MEMACC

Board-level register access to GPIB-VXI interface number 1.

GPIB2::INTFC

Interface or raw resource for GPIB interface 2.

VXI::1::BACKPLANE

Mainframe resource for chassis 1 on the default VXI system, which is interface 0.

GPIB-VXI2:: BACKPLANE

Mainframe resource for default chassis on GPIB-VXI interface 2.

PXI0::3-18::INSTR

PXI device 18 on bus 3.

PXI0::3-18.2::INSTR

Function 2 on PXI device 18 on bus 3.

PXI0::21::INSTR

PXI device 21 on bus 0.

PXI0::CHASSIS1::SLOT4::INSTR

PXI device in slot 4 of chassis 1.

PXI0::MEMACC

Access to system controller memory available to PXI devices.

PXI0::1::BACKPLANE

Mainframe resource for PXI chassis 1.

TCPIP0::1.2.3.4::999::SOCKET

Raw TCPIP access to port 999 at the specified address.

TCPIP0::[fe80::1]::999::SOCKET

Raw TCPIP using IPv6 address

TCPIP::@[fe80::1]::hislip0::INSTR

A TCP/IP device using HiSLIP rev 2 located at IPv6 IP address fe80::1. The connection is a secure connection with an anonymous VISA client.

TCPIP::devicename.company.com::INSTR

TCPIP device using VXI-11 located at the specified address. This uses the default LAN Device Name of inst0.

TCPIP0::[fe80::1]::hislip0::INSTR

A TCP/IP device using HiSLIP located at IPv6 IP address fe80::1.

USB::0x1234::0x5678::A22-5::INSTR

A USB device with manufacturer ID 0x1234, model code 0x5678, and serial number A22-5.  This uses the device's first available USBTMC interface.  This is usually number 0.

Example: Opening a Session

This sample shows one way to open a VISA session with the GPIB device at primary address 23.

ViSession defaultRM, vi;
.
.
viOpenDefaultRM(&defaultRM);
viOpen(defaultRM, "GPIB0::23::INSTR", VI_NULL, VI_NULL,&vi);
.
.
viClose(vi);
viClose(defaultRM);