User`s guide

76 Agilent VISA User’s Guide
3 Programming with VISA
When you use VI_QUEUE in the mechanism parameter, you
are specifying that the events will be put into a queue. Then,
when a viWaitOnEvent function is invoked, the program
execution will suspend until the enabled event occurs or the
timeout period specified is reached. If the event has already
occurred, the viWaitOnEvent function will return
immediately.
Sample: Enabling a Hardware Trigger Event
This sample illustrates enabling a hardware trigger event.
viEnableEvent(vi, VI_EVENT_TRIG, VI_QUEUE,
VI_NULL);
The VI_QUEUE mechanism specifies that when an event
occurs, it will go into a queue. If you specify
VI_ALL_ENABLE_EVENTS in the eventType parameter, all
events that have previously been enabled on the specified
session will be enabled for the mechanism specified in this
function call. Use the viDisableEvent function to stop
servicing the event specified.
Wait on the Event
When using the viWaitOnEvent function, specify the session,
the event type to wait for, and the timeout period to wait:
viWaitOnEvent(vi, inEventType, timeout,
outEventType, outContext);
Table 23 Descriptions of Parameters Used to Enable Events
Parameter Description
vi The session the handler will be installed on.
eventType The type of event to enable.
mechanism The mechanism by which the event will be enabled. Specify
VI_QUEUE to use the queuing method.
context Not used in VISA 1.0. Use VI_NULL.