EasyManua.ls Logo

Keysight Technologies 8163A/B - Page 240

Keysight Technologies 8163A/B
306 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
240 8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
6 VISA Programming Examples
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 zeroing */
errStatus = viSetAttribute(vi,VI_ATTR_TMO_VALUE,20000);
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* clear error queue */
errStatus = viPrintf(vi,"*CLS\n");
checkError(vi,errStatus);
/* read the wavelength from the laser source */
errStatus = viQueryf(vi,"SOURCE2:CHAN1:WAV?\
n","%s",replyBuf);
checkError(vi,errStatus);
/* feed the source wavelength into the power meter making
sure to measure the maximum power of the source */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:WAV %s\
n",replyBuf);
checkError(vi,errStatus);
/* turn auto range on */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:RANGE:AUTO 1\
n");
checkError(vi,errStatus);
/* change the power unit of the power meter to dBm */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:UNIT 0\n");
checkError(vi,errStatus);
/*set the averaging time for measuring to 20 ms,
therefore no timeout needs to implemented */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:ATIME 0.02\n");
checkError(vi,errStatus);
/* set the attenuation to zero for maximum power */
errStatus = viPrintf(vi,"SOURCE2:CHAN1:POW:ATT 0.0\n");
checkError(vi,errStatus);

Table of Contents

Related product manuals