Agilent Technologies ESA-E Series Programmer's Manual page 126

Esa spectrum analyzers
Hide thumbs Also See for ESA-E Series:
Table of Contents

Advertisement

Programming Examples
Determine if an Error has Occurred
/*Get the HP-IB address of the insrument, which has interrupted* /
viQueryf(viESA,"SYST :COMM :GPIB :SELF :ADDR?\n","%t", cBuf) ;
printf ("\n Instrument at HP-IB Address %s Has Generated an Interrupt!\n",cBuf) ;
/*Get the status byte* /
/* If the ESA generated the interrupt, determine the nature of the interrup t
either a measurement is uncalibrated or an error message has occurred?* /
viQueryf(viESA, "STAT :QUES :INT :EVEN?\n", "%d", &iStatusByte) ;
if ( (0x08 & iStatusByte) )
printf("\n SRQ message :\t Measurement uncalibrated\n") ;
I*
If the ESA generated the interrupt, determine the nature of the interrupt ;
did is the measurement complete or an error message occur?* /
viQueryf(viESA, "*ESR?\n", "%d", &iStatusByte) ;
if ( (iStatusByte 1=0) && (Ox01 & iStatusByte) )
printf("\n SRQ message :\t Measurement complete\n") ;
else if ( (iStatusByte 1=0) && (0x02
I
OxlO
I
0x20 & iStatusByte ) )
printf ("\n SRQ message :\t Error Message Occurred\n") ;
/*Return successfully* /
iSrgOccurred =1 ;
return VI_SUCCESS ;
}
void main( )
{
/*Program Variables* /
ViStatus viStatus = 0 ;
long
lOpc= OL ;
int
iIntNum= 0 ;
long lCount= OL ;
1*
Open a HP-IB session at address 18* 1
viStatus=viOpenDefaultRM(&defaultRM) ;
viStatus =viOpen(defaultRM,"GPIBO : :18",VI NULL,VI NULL,&viESA) ;
if(viStatus )
{
printf("Could not open a session to HP-IB device at address 18!\n") ;
exit (0) ;
}
/*Clear the instrument* /
viClear(viESA) ;
/*Reset the instrument* /
viPrintf(viESA,"*RST\n") ;
3-66
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents