Technical data
• It is out of context.
Sending Commands using VISA
The following code example shows how to use the Agilent IO Libraries Suite to
connect to the instrument via GPIB. This code also contains commented examples
for USB and LAN.
This example queries the device for the identification string and prints the results.
#include <visa.h>
#include <stdio.h>
void main () {
ViSession defaultRM, vi;
char buf [256] = {0};
/* Open session to GPIB device at address 14 */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, "GPIB0::14::INSTR", VI_NULL,VI_NULL, &vi);
/* Alternatively open a session to the device at
IP address 10.0.1.255 */
/* viOpen (defaultRM,
"TCPIP0::10.0.1.255::INSTR", VI_NULL,VI_NULL, &vi); */
/* Or open a session to the USB device */
/* viOpen (defaultRM,
"usb0[2391::20496::SNN4900AXXXDE::0::INSTR]",
VI_NULL,VI_NULL, &vi); */
/* Or if you have assigned an alias BERT-Lab */
/* viOpen (defaultRM, "BERT-Lab", VI_NULL, VI_NULL, &vi); */
/* Initialize device */
viPrintf (vi, "*RST\n");
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?\n");
/* Read results */
viScanf (vi, "%t", &buf);
/* Print results */
printf ("Instrument identification string: %s\n", buf);
/* Close session */
viClose (vi);
viClose (defaultRM);
}
This returns the identity string "Manufacturer, Model, Serial Number, Firmware
Level" e.g. "AGILENT TECHNOLOGIES,N4903B,3331U00101,A.01.01".
SCPI Command Language 4
Agilent J-BERT N4903B High-Performance Serial BERT 87