User`s guide

74 Agilent VISA User’s Guide
3 Programming with VISA
/* Wait a while for the SRQ to be generated and
for the handler to be called. Print something
while we wait */
printf("Waiting for an SRQ to be generated.");
for (count = 0 ; (count < 10) &&
(srqOccurred == 0);count++) {
long count2 = 0;
printf( "." );
while ( (count2++ < 100) && (srqOccurred ==0)
){YIELD;
}
}
printf( "\n" );
/* disable and uninstall the handler */
viDisableEvent(vi, VI_EVENT_SERVICE_REQ,
VI_HNDLR);
viUninstallHandler(vi, VI_EVENT_SERVICE_REQ,
mySrqHdlr, (ViAddr)10);
/* Clean up - do not leave device in error
state */
viPrintf( vi, "*CLS\n" );
/* close the sessions */
viClose(vi);
viClose(defaultRM);
printf( "End of program\n" );}
Using the Queuing Method
The queuing method is generally used when an immediate
response from your application is not needed. To use the
queuing method for receiving notification that an event has
occurred, you must do the following:
Enable one or several events with the viEnableEvent
function.
When ready to query, use the viWaitOnEvent function to
check for queued events.