HP ESA-E Series Programmer's Manual page 122

Esa spectrum analyzers
Table of Contents

Advertisement

Programming Examples
Status Register–Determine When a Measurement is Done
}
/*Interrupt handler,trigger event handler */
ViStatus _VI_FUNCH
eventType, ViEvent ctx,ViAddr userHdlr)
{
ViUInt16 iStatusByte;
/* Make sure it is an SRQ event, ignore if stray event*/
if (eventType!=VI_EVENT_SERVICE_REQ)
{
printf ("\n Stray event type0x%1x\n",eventType);
/*Close the context before returning*/
viClose(ctx);
return VI_SUCCESS;
}
/* When an interrupt occurs,determine which device
generated the interrupt(if an instrument other than the ESA
generates the interrupt, simply report "analyzer at HP-IB
Address xxx Has Generated an Interrupt").*/
printf ("\n\n SRQ event occurred!\n");
printf ("\n ... Original Device Session = %t\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; did is the measurement complete or
an error message occur?*/
viQueryf(viESA, "*ESR?\n", "%d", &iStatusByte);
if ( (0x01 & iStatusByte))
printf("\n SRQ message:\t Measurement complete\n");
else if ( (0x02 | 0x10 | 0x20 & iStatusByte ))
printf ("\n SRQ message:\t Error Message Occured\n");
/*Close the context before returning*/
viClose(ctx);
3-58
mySrqHdlr(ViSession viESA, ViEventType
Chapter 3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents