Supported Events

NI-VISA

Supported Events

VISA defines the following generic and INSTR-specific event types.

Generic and INSTR-Specific Event Types

Event Type Description Resource Class(es), Other Notes
VI_EVENT_IO_COMPLETION Notification that an asynchronous I/O operation has completed. The I/O Completion event applies to all asynchronous operations, which for INSTR includes viReadAsync(), viWriteAsync(), and viMoveAsync(). For resource classes that do not support asynchronous operations, this event type is not applicable.
VI_EVENT_EXCEPTION Notification that an error condition (exception) has occurred during an operation invocation. The exception event supports only the callback model. Refer to Exception Handling for more information about this event type.
VI_EVENT_SERVICE_REQ Notification of a service request (SRQ) from the device. Supported for message based INSTR classes, including GPIB, VXI, GPIB-VXI, and TCPIP.
VI_EVENT_VXI_SIGP Notification of a VXIbus signal or VXIbus interrupt from the device. Supported for VXI INSTR only.
VI_EVENT_VXI_VME_INTR Notification of a VXIbus interrupt from the device. Supported for VXI INSTR only. This applies to both VXI and VME devices.
VI_EVENT_TRIG Notification of a VXIbus trigger. Supported for VXI INSTR and VXI BACKPLANE only.
VI_EVENT_PXI_INTR Notification of a PCI/PXI interrupt from the device. Supported for PXI INSTR only. Not supported on all platforms.
VI_EVENT_ASRL_BREAK Notification that a break signal was received. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac.
VI_EVENT_ASRL_CTS Notification that the Clear To Send (CTS) line changed state. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac. If the CTS line changes state quickly several times in succession, not all line state changes will necessarily result in event notifications.
VI_EVENT_ASRL_DCD Notification that the Data Carrier Detect (DCD) line changed state. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac. If the DCD line changes state quickly several times in succession, not all line state changes will necessarily result in event notifications.
VI_EVENT_ASRL_DSR Notification that the Data Set Ready (DSR) line changed state. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac. If the DSR line changes state quickly several times in succession, not all line state changes will necessarily result in event notifications.
VI_EVENT_ASRL_RI Notification that the Ring Indicator (RI) input signal was asserted. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac.
VI_EVENT_ASRL_CHAR Notification that at least one data byte has been received. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac. Each data character will not necessarily result in an event notification.
VI_EVENT_ASRL_TERMCHAR Notification that the termination character has been received. Supported for Serial INSTR only. This event is supported for all serial ports on Windows and LabVIEW RT, and ENET-Serial on all platforms. Except for ENET-Serial, it is not supported for serial ports on Linux or Mac. The actual termination character is specified by setting VI_ATTR_TERMCHAR prior to enabling this event. For this event, the setting of VI_ATTR_TERMCHAR_EN is ignored.

To learn about other event types defined for other resource classes, refer to Interface-Specific Information or the appropriate event topics.

VISA events use a list of attributes to maintain information associated with the event. You can access the event attributes using the viGetAttribute() operation, just as for the session and resource attributes. Remember to use the eventContext as the first parameter, rather than the I/O session.

All VISA events support the generic event attribute VI_ATTR_EVENT_TYPE. This attribute returns the identifier of the event type. In addition to this attribute, individual events may define attributes to hold additional event information. The events listed below define the accompanying additional attributes; the other event types do not define any additional attributes.

  • VI_EVENT_IO_COMPLETION defines, among other attributes, VI_ATTR_STATUS and VI_ATTR_RET_COUNT/VI_ATTR_RET_COUNT_32/VI_ATTR_RET_COUNT_64, which provide information about how the asynchronous I/O operation completed.
  • VI_EVENT_VXI_SIGP defines VI_ATTR_SIGP_STATUS_ID, which contains the 16-bit Status/ID value retrieved during the interrupt or from the Signal register.
  • VI_EVENT_VXI_VME_INTR defines VI_ATTR_RECV_INTR_LEVEL and VI_ATTR_INTR_STATUS_ID, which provide the interrupt level and 32-bit interrupt Status/ID value, respectively.
  • VI_EVENT_TRIG defines VI_ATTR_RECV_TRIG_ID, which provides the trigger line on which the trigger was received.
  • VI_EVENT_EXCEPTION defines VI_ATTR_STATUS and VI_ATTR_OPER_NAME, which provide information about what error was generated and which operation generated it, respectively.

All the attributes VISA events support are read-only attributes; a user application cannot modify their values. Refer to the appropriate event topics for detailed information on the specific events.