User`s guide

Programming with VISA 3
Agilent VISA User’s Guide 77
The event must have previously been enabled with
VI_QUEUE specified as the mechanism parameter.
Sample: Wait on Event for SRQ
This sample shows how to install a wait on event for service
requests.
viEnableEvent(vi, VI_EVENT_SERVICE_REQ,
VI_QUEUE, VI_NULL);
viWaitOnEvent(vi, VI_EVENT_SERVICE_REQ,
VI_TMO_INFINITE, &eventType, &event);
.
.
viDisableEvent(vi, VI_EVENT_SERVICE_REQ,
VI_QUEUE);
Every time a wait on event is invoked, an event context
object is created. Specifying VI_TMO_INFINITE in the
timeout parameter indicates that the program execution will
suspend indefinitely until the event occurs. To clear the
event queue for a specified event type, use the
viDiscardEvents function.
Sample: Trigger Event Queuing
This program enables the trigger event in a queuing mode.
When the viWaitOnEvent function is called, the program
will suspend operation until the trigger line is fired or the
timeout period is reached. Since the trigger lines were
already fired and the events were put into a queue, the
function will return and print the trigger line that fired.
This program is intended to show specific VISA functionality
and does not include error trapping. Error trapping,
however, is good programming practice and is recommended
in your VISA applications. See “Trapping Errors” in this
chapter for more information.
This sample program is installed on your system in the
ProgrammingSamples subdirectory. See the IO Libraries
Suite Online Help for locations of sample programs.