User`s guide

58 Agilent VISA User’s Guide
3 Programming with VISA
Enable one or several events with viEnableEvent and call
the viWaitOnEvent function. The viWaitOnEvent function
will suspend the program execution until the specified
event occurs or the specified timeout period is reached.
This is called queuing.
The queuing and callback mechanisms are suitable for
different programming styles. The queuing mechanism is
generally useful for non- critical events that do not need
immediate servicing. The callback mechanism is useful when
immediate responses are needed. These mechanisms work
independently of each other, so both can be enabled at the
same time. By default, a session is not enabled to receive
any events by either mechanism.
The viEnableEvent operation can be used to enable a
session to respond to a specified event type using either the
queuing mechanism, the callback mechanism, or both.
Similarly, the viDisableEvent operation can be used to
disable one or both mechanisms. Because the two methods
work independently of each other, one can be enabled or
disabled regardless of the current state of the other.
Events that can be Enabled
The following table shows the events that are implemented
for Agilent VISA for each resource class, where AP = Access
Privilege, RO - Read Only, and RW = Read/Write. Note that
some resource classes/events, such as the SERVANT class,
are not implemented by Agilent VISA and are not listed in
the following tables.
Once the application has received an event, information
about that event can be obtained by using the
viGetAttribute function on that particular event context. Use
the VISA viReadSTB function to read the status byte of the
service request.