HP ESA-E Series Programmer's Manual page 129

Esa spectrum analyzers
Table of Contents

Advertisement

}
/* When an interrupt occurs, determine which device
generated the interrupt (if an instrument other than the ESA
generates the interrupt, simply report "Instrument at HP-IB
Address xxx Has Generated an Interrupt").*/
printf ("\n SRQ Event Occured!\n");
printf ("\n ... Original Device Sesion = %1d\n",viESA);
/*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 interrupt, 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");
/* If the ESA generated the interrupt, determine the
nature of the interrupt; did
error message occur?*/
viQueryf(viESA, "*ESR?\n", "%d", &iStatusByte);
if ( (iStatusByte !=0) && (0x01 & iStatusByte))
printf("\n SRQ message:\t Measurement complete\n");
else if ( (iStatusByte !=0) && (0x02 | 0x10 | 0x20 &
iStatusByte ))
printf ("\n SRQ message:\t Error Message Occured\n");
/*Close the context before returning*/
viClose(ctx);
iSrqOccurred
return VI_SUCCESS;
}
void main()
Chapter 3
the measurement complete or an
=1;
Programming Examples
Determine if an Error has Occurred
3-65

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents