
Section 2: Installation
Series 3700A System Switch/Multimeter Reference Manual
2-26
3700AS-901-01 Rev. D/June 2018
Addressing instruments through GPIB
There are two different resource classes in VISA for the GPIB bus.
INSTR
is the basic class that everyone uses. It allows application software to send and receive data
and commands without dealing with some low level GPIB nuances. This class is recommended for
typical GPIB communication.
The
INTFC
class allows finer control over the GPIB controller card in the computer. You must comply
with the IEEE-488.1 protocol and tell the instrument to listen and the controller to talk before sending
a message to the instrument. This class allows you to communicate to the instrument using low-level
GPIB commands. Refer to your VISA documentation for more details on how to use this class.
The GPIB INSTR resource class format is:
GPIB[
board
]::
primary address
[::
secondary address
][::INSTR]
board
is the number of the GPIB card, if there is more than one in the computer. If there is only one
GPIB card, do not include
board
, but do not leave a space.
primary address
is the main GPIB address of the instrument, which can be changed, if
necessary, through the front panel of the instrument.
secondary address
is for secondary addressing in GPIB. Some instruments have subinstruments
or cards inside the main instrument or backplane. The primary address identifies the main instrument.
The secondary address identifies subinstruments. Refer to the instrument user manual for the
secondary address, if applicable.
Sending raw commands to an instrument
The next sections show you how to use VISA-C and VISA-COM to send raw instrument commands
without using the instrument drivers.
VISA-C sample code
The following is a simple C/C++ console application that reads back the instrument identification
string using VISA-C. You need to include
visa.h
and link with the
visa32.lib
file.
#include "stdafx.h"
#include <visa.h>
#define checkErr(fCall) if (error = (fCall), (error = (error <
0) ? error : VI_SUCCESS)) \
{goto Error;} else error = error
int _tmain(int argc, _TCHAR* argv[])
{
ViSession defaultRM, vi;
char buf [256] = {0};
ViStatus error = VI_SUCCESS;
/* Open session to GPIB device at address 22 */
checkErr(viOpenDefaultRM(&defaultRM));
checkErr(viOpen(defaultRM, "GPIB0::14::INSTR", VI_NULL,VI_NULL, &vi));
/* Initialize device */
checkErr(viPrintf(vi, "*RST\n"));