
Programming with VISA
3
Agilent VISA User’s Guide
65
Example: Wait on Event for SRQ
This example 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.
Example: 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 example program is installed on your system in the
ProgrammingSamples
subdirectory. See the
IO Libraries Suite
Online Help
for locations of example programs.
/
* evntqueu.c
This sample program illustrates enabling an
event queue using viWaitOnEvent. Note that you
must change the device address. */
#include <visa.h>
#include <stdio.h>
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 ...