Keysight Technologies 8163A/B Programming Manual page 231

Table of Contents

Advertisement

8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
/* Initialize visa resource manger */
errStatus = viOpenDefaultRM (&defaultRM);
if(errStatus < VI_SUCCESS)
{ printf("Failed to open VISA Resource manager\n");
exit(errStatus);
}
/* Open session to GPIB device at address 20; the VI_NULL
parameters 3,4
are mandatory and not used for VISA 1.0*/
errStatus = viOpen (defaultRM, "GPIB::20::INSTR",
VI_NULL,VI_NULL,&vi);
if(errStatus < VI_SUCCESS)
{ printf("Failed to open instrument\n");
exit(errStatus);
}
/* set timeout to 20 sec; this should work for all
commands except for zeroing or READ commands with averaging
times greater than the timeout */
errStatus = viSetAttribute(vi,VI_ATTR_TMO_VALUE,20000);
checkError(vi,errStatus);
/* get the identification string of the instrument
mainframe*/
errStatus = viQueryf(vi,"%s\n","%t","*IDN?",replyBuf);
if(errStatus < VI_SUCCESS)
{ checkError(vi,errStatus); }
else printf("%s",replyBuf);
/* identify the installed modules */
errStatus = viQueryf(vi,"%s\n","%t","*OPT?",replyBuf);
if(errStatus < VI_SUCCESS)
{ checkError(vi,errStatus); }
else printf("%s",replyBuf);
/* get information about the available options of a slot
*/
errStatus = viQueryf(vi,"%s","%t","SLOT1:OPT?\
n",replyBuf);
if(errStatus < VI_SUCCESS)
{ checkError(vi,errStatus); }
else printf("%s",replyBuf);
/*loop, until a key is pressed */
while(!scanf("%c",&c));
/*close the session */
viClose(vi);
}
VISA Programming Examples
6
231

Advertisement

Table of Contents
loading

This manual is also suitable for:

8164a/b8166a/b

Table of Contents