
62
Agilent VISA User’s Guide
3
Programming with VISA
/* Send a bogus command to the message-based
device to cause an SRQ. Note: 'IDN' causes the
error -- 'IDN?' is the correct syntax */
viPrintf( vi, "IDN\n" );
/* 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 ( (+ < 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.
Summary of Contents for E2094S
Page 6: ...6 Agilent VISA User s Guide ...
Page 116: ...116 Agilent VISA User s Guide 4 Programming via GPIB and VXI ...
Page 126: ...126 Agilent VISA User s Guide 5 Programming via LAN ...
Page 143: ...Glossary Agilent VISA User s Guide 143 Windows notification area See notification area ...