EasyManua.ls Logo

Keysight Technologies 8163A/B - Page 236

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...
236 8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
6 VISA Programming Examples
}
/*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);
/* make sure that the reference is not used */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:REF:STATE 0\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* clear the error queue */
errStatus = viPrintf(vi,"*CLS\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* turn auto range on */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:RANGE:AUTO 1\
n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* change the power unit to watt */
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:UNIT W\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/*set the averaging time for measuring to 0.5s*/
averagingTime = 0.5;
errStatus = viPrintf(vi,"SENS1:CHAN1:POW:ATIME %f\
n",averagingTime);
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* turn continous measuring off */
errStatus = viPrintf(vi,"INIT1:CHAN1:CONT 0\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* trigger a measurement */
errStatus = viPrintf(vi,"INIT1:CHAN1:IMM\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/* read 10 values and display the result; */
for (i = 0; i < 10; i++)
{
/* Now because an averaged value is available, the value
will be fetched */
errStatus = viQueryf(vi,"%s","%s","FETCH1:CHAN1:POW?\
n",replyBuf);
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);

Table of Contents

Related product manuals