User`s guide

Programming with VISA 3
Agilent VISA User’s Guide 57
Using VI_QUEUE in the mechanism parameter specifies a queuing
method for the events to be handled. If you use both VI_QUEUE and
one of the mechanisms listed above, notification of events will be sent
to both locations. See the next subsection for information on the
queuing method.
Example: Enabling a Hardware Trigger Event This example
illustrates enabling a hardware trigger event.
viInstallHandler(vi, VI_EVENT_TRIG,
my_handler,&addr);
viEnableEvent(vi, VI_EVENT_TRIG, VI_HNDLR,
VI_NULL);
The VI_HNDLR mechanism specifies that the handler installed for
VI_EVENT_TRIG will be called when a hardware trigger occurs.
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.
Table 17 Description of Parameters Used to Install a Handler
Parameter Description
vi The session on which the handler will be installed.
eventType The type of event to enable.
mechanism The mechanism by which the event will be enabled. It can
be enabled in several different ways. You can use
VI_HNDLR in this parameter to specify that the installed
handler will be called when the event occurs. Use
VI_SUSPEND_HNDLR in this parameter, which puts the
events in a queue and waits to call the installed handlers
until viEnableEvent is called with VI_HNDLR specified in
the mechanism parameter. When viEnableEvent is called
with VI_HNDLR specified, the handler for each queued
event will be called.
context Not used in VISA 1.0. Use VI_NULL.