EasyManua.ls Logo

Keysight Technologies 8163A/B - Page 242

Keysight Technologies 8163A/B
306 pages
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...
242 8163A/B, 8164A/B & 8166A/B Mainframes Programming Guide
6 VISA Programming Examples
if(i == 10)
{
/* reduce the output power for 3.0 dB */
errStatus = viPrintf(vi,"SOURCE2:CHAN1:POW:ATT 3.0\
n");
checkError(vi,errStatus);
}
if(i == 20)
{
/* reduce the output power for 6.0 dB */
errStatus = viPrintf(vi,"SOURCE2:CHAN1:POW:ATT 6.0\
n");
checkError(vi,errStatus);
}
}
/* loop, until a key is pressed */
while(!scanf("%c",&c));
/* turn the laser off */
errStatus = viPrintf(vi,"SOURCE2:CHAN1:POW:STATE 0\n");
if (errStatus < VI_SUCCESS) checkError(vi,errStatus);
/*close the session */
viClose(vi);
}
void checkError(ViSession session, ViStatus err_status )
{
ViStatus error;
ViChar errMsg[256];
error = viQueryf(session,"SYST:ERR?\n","%t",errMsg);
if (error == VI_ERROR_TMO)
{
printf("System Error!\n") ;
exit(1);
}
else
{
/* only errors should be displayed */

Table of Contents

Related product manuals