How to Measure Power using FETCh and READ
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 */
if(errMsg[0] != '+')
printf("error:%ld --> %s\n", err_status,errMsg) ;
}
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <visa.h>
/* function prototypes for this examples */
/* function for a simple error handling explained in example 1 */
void checkError(ViSession session, ViStatus err_status );
void main (void)
{
ViStatus
ViSession
ViSession
ViChar
ViChar
ViChar
ViReal64 averagingTime; /* averaging time */
ViInt32 i;
HP 8163A Lightwave Multimeter, HP 8164A Lightwave Measurement System,
& HP 8166A Lightwave Multichannel System User's Guide, E1299
How to Measure Power using
FETCh and READ
The example shows the difference between a "FETCh" and a "READ" command.
Install a power meter in Slot 1, before executing this example.
errStatus;
/* returned error code from visa call */
defaultRM;
/* default visa resource manager variable */
vi;
/* current session handle */
replyBuf[256]; /* buffer holding answers of the instrument*/
compBuf[256]; /* buffer used for comparsion */
c;
/* used in the keyboard wait loop */
/* loop counter */
Programming Examples
131