documentation.HELP! NI-VISA Documentation

VISA Events

NI-VISA

previous page next page

VISA Events

The following topics describe the VISA event model and how to use it. They discuss the various events VISA supports and the event handling paradigm.

Introduction

Supported Events

Enabling and Disabling Events

Queuing

Callbacks

Callback Modes

Independent Queues

The userHandle Parameter

Queuing and Callback Mechanism Sample Code

The Life of the Event Context

Event Context with the Queuing Mechanism

Event Context with the Callback Mechanism

Exception Handling

previous page start next page

Menu

  • Homepage

Table of contents

  • NI-VISA Help
    • Related Documentation
    • Using Help
      • Conventions
      • Navigating Help
      • Searching Help
      • Printing Help File Topics
    • Introduction
      • What You Need to Get Started
      • VXIplug&play Overview
      • Supported Platforms
    • User Reference
      • How to Use the User Reference Topics
      • Introductory Programming Examples
        • Example of Message-Based Communication
          • C Example
          • Visual Basic Example
          • Example Discussion
        • Example of Register-Based Communication
          • C Example
          • Visual Basic Example
          • Example Discussion
        • Example of Handling Events
          • Callbacks
          • Queuing
          • C Example
          • Visual Basic Example
          • Example Discussion
        • Example of Locking
          • C Example
          • Visual Basic Example
          • Example Discussion
      • VISA Overview
        • Background
        • VISA Terminology
          • Beginning Terminology
          • Communication Channels: Sessions
          • The Resource Manager
        • Examples of Interface Independence
      • Initializing Your VISA Application
        • Introduction
        • Opening a Session
          • C Example
          • Visual Basic Example
        • Finding Resources
          • C Example
          • Visual Basic Example
          • Finding VISA Resources Using Regular Expressions
          • Attribute-Based Resource Matching
            • C Example
            • Visual Basic Example
        • Configuring a Session
          • Accessing Attributes
          • Common Considerations for Using Attributes
      • Message-Based Communication
        • Introduction
        • Basic I/O Services
          • Synchronous Read/Write Services
          • Asynchronous Read/Write Services
          • Clear Service
          • Trigger Service
          • Status/Service Request Service
          • Example VISA Message-Based Application
            • C Example
            • Visual Basic Example
        • Formatted I/O Services
          • Formatted I/O Operations
          • I/O Buffer Operations
          • Variable List Operations
          • Manually Flushing the Formatted I/O Buffers
          • Automatically Flushing the Formatted I/O Buffers
          • Resizing the Formatted I/O Buffers
          • Formatted I/O Read and Low-Level I/O Receive Buffers
          • Formatted I/O Write and Low-Level I/O Transmit Buffers
          • Recommendations for Using the VISA Buffers
        • Formatted I/O Instrument Driver Examples
          • Integers
          • Floating Point Values
          • Strings
          • Data Blocks
      • Register-Based Communication
        • Introduction
        • High-Level Access Operations
        • High-Level Block Operations
        • Low-Level Access Operations
          • Overview of Register Accesses from Computers
          • Using VISA to Perform Low-Level Register Access
          • Operations vs. Pointer Dereference
          • Manipulating the Pointer
            • C Example
            • Visual Basic Example
          • Bus Errors
        • Comparison of High-Level and Low-Level Access
          • Speed
          • Ease of Use
          • Accessing Multiple Address Spaces
        • Shared Memory Operations
          • Shared Memory Sample Code
            • C Example
            • Visual Basic Example
      • VISA Events
        • Introduction
        • Supported Events
        • Enabling and Disabling Events
        • Queuing
        • Callbacks
          • Callback Modes
          • Independent Queues
          • The userHandle Parameter
        • Queuing and Callback Mechanism Sample Code
          • C Example
          • Visual Basic Example
        • Life of the Event Context
          • Event Context with the Queuing Mechanism
          • Event Context with the Callback Mechanism
        • Exception Handling
      • VISA Locks
        • Introduction
        • Lock Types
          • Lock Sharing
          • Acquiring an Exclusive Lock While Owning a Shared Lock
          • Nested Locks
        • Locking Sample Code
          • C Example
          • Visual Basic Example
      • .NET
    • NI-VISA Utilities
      • NI Spy: Debugging Tool
      • Interactive Control of VISA
      • Measurement & Automation Explorer (MAX)
      • visaconf
      • NI-VISA Driver Wizard
        • Overview
        • Hardware Bus
        • Basic FireWire Device Information
        • Basic PXI/PCI Device Information
        • Basic USB Device Information
        • Interrupt Detection Information
        • Interrupt Removal Information
        • NI-VISA PXI Interrupt Information
        • Disarm Interrupt Information
        • PXI Express Configuration
        • Output Files Information
        • Installation Options
        • Example for PXI
        • Example for USB
    • Interface-Specific Information
      • GPIB
        • Introduction to Programming GPIB Devices in VISA
        • Comparison Between NI-VISA and NI-488.2 APIs
        • Board-Level Programming
        • GPIB Summary
      • GPIB-VXI
        • Introduction to Programming GPIB-VXI Devices in VISA
        • Register-Based Programming with the GPIB-VXI
        • Additional Programming Issues
        • GPIB-VXI Summary
      • VXI
        • Introduction to Programming VXI Devices in VISA
        • VXI/VME Interrupts and Asynchronous Events in VISA
        • Performing Arbitrary Access to VXI Memory with VISA
        • Other VXI Resource Classes and VISA
        • Comparison Between NI-VISA and NI-VXI APIs
        • Summary of VXI in VISA
      • PXI/PCI
        • Introduction to Programming PXI Devices in NI-VISA
        • User-Level Functionality
        • Configuring NI-VISA to Recognize a PXI Device
        • Using LabWindows/CVI to Install Your Device .inf Files
        • Other PXI Resource Classes and VISA
        • PXI Summary
        • Using the NI-VISA Driver Wizard and NI-VISA to Register-Level Program a PXI/PCI Device Under Windows
          • PXI and VISA Background
          • Configuring NI-VISA to Recognize a PXI/PCI Device
            • Hardware Bus
            • Basic Device Information
            • Interrupt Detection Information
            • Interrupt Removal Information
            • Interrupt Disarm Information
            • PXI Express Configuration Information
            • Output Files Generation
            • Installation Options
          • Using NI-VISA to Communicate with a PXI/PCI Device
            • Step 1 -- Initialize the Device
            • Step 2 -- Communicating with the PXI Device
            • Step 3 -- Closing the Device
          • Using NI-VISA to Handle Events from a PXI/PCI Device
      • Serial
        • Introduction to Programming Serial Devices in VISA
        • Default vs. Configured Communication Settings
        • Controlling the Serial I/O Buffers
        • National Instruments ENET Serial Controllers
        • Serial Summary
      • Ethernet
        • Introduction to Programming Ethernet Devices in VISA
        • VISA Sockets vs. Other Sockets APIs
        • Ethernet Summary
      • Remote NI-VISA
        • Introduction to Programming Remote Devices in NI-VISA
        • How to Configure and Use Remote NI-VISA
        • Remote NI-VISA Summary
      • USB
        • Introduction to Programming USB Devices in VISA
        • Configuring NI-VISA to Recognize a RAW USB Device
        • USB Summary
        • USB Instrument Control Tutorial
          • USB and VISA Background
          • Configuring NI-VISA to Control Your USB Device
            • Create the .inf File Using the NI-VISA Driver Wizard
            • Install the .inf Files and USB Device
            • Test the Device with VISA Interactive Control
          • Using NI-VISA to Communicate with Your USB Device
          • USB on Linux and Mac
      • FireWire
        • Introduction to Programming FireWire Devices in VISA
        • Configuring NI-VISA to Recognize an INSTR FireWire Device
        • FireWire Summary
    • Function Reference
      • Overview of the VISA API
        • Description of the API
        • VISA Access Mechanisms
        • VISA Resource Types
        • VISA Resource Syntax and Examples
      • Attributes
        • Attributes
        • VI_ATTR_4882_COMPLIANT
        • VI_ATTR_ASRL_ALLOW_TRANSMIT
        • VI_ATTR_ASRL_AVAIL_NUM
        • VI_ATTR_ASRL_BAUD
        • VI_ATTR_ASRL_BREAK_LEN
        • VI_ATTR_ASRL_BREAK_STATE
        • VI_ATTR_ASRL_CONNECTED
        • VI_ATTR_ASRL_CTS_STATE
        • VI_ATTR_ASRL_DATA_BITS
        • VI_ATTR_ASRL_DCD_STATE
        • VI_ATTR_ASRL_DISCARD_NULL
        • VI_ATTR_ASRL_DSR_STATE
        • VI_ATTR_ASRL_DTR_STATE
        • VI_ATTR_ASRL_END_IN
        • VI_ATTR_ASRL_END_OUT
        • VI_ATTR_ASRL_FLOW_CNTRL
        • VI_ATTR_ASRL_PARITY
        • VI_ATTR_ASRL_REPLACE_CHAR
        • VI_ATTR_ASRL_RI_STATE
        • VI_ATTR_ASRL_RTS_STATE
        • VI_ATTR_ASRL_STOP_BITS
        • VI_ATTR_ASRL_WIRE_MODE
        • VI_ATTR_ASRL_XOFF_CHAR
        • VI_ATTR_ASRL_XON_CHAR
        • VI_ATTR_BUFFER
        • VI_ATTR_CMDR_LA
        • VI_ATTR_DEST_ACCESS_PRIV
        • VI_ATTR_DEST_BYTE_ORDER
        • VI_ATTR_DEST_INCREMENT
        • VI_ATTR_DEV_STATUS_BYTE
        • VI_ATTR_DMA_ALLOW_EN
        • VI_ATTR_EVENT_TYPE
        • VI_ATTR_FDC_CHNL
        • VI_ATTR_FDC_MODE
        • VI_ATTR_FDC_USE_PAIR
        • VI_ATTR_FILE_APPEND_EN
        • VI_ATTR_FIREWIRE_DEST_UPPER_OFFSET
        • VI_ATTR_FIREWIRE_LOWER_32_CHIP_ID
        • VI_ATTR_FIREWIRE_SRC_UPPER_OFFSET
        • VI_ATTR_FIREWIRE_UPPER_8_CHIP_ID
        • VI_ATTR_FIREWIRE_VENDOR_ID
        • VI_ATTR_FIREWIRE_WIN_UPPER_OFFSET
        • VI_ATTR_GPIB_ADDR_STATE
        • VI_ATTR_GPIB_ATN_STATE
        • VI_ATTR_GPIB_CIC_STATE
        • VI_ATTR_GPIB_HS488_CBL_LEN
        • VI_ATTR_GPIB_NDAC_STATE
        • VI_ATTR_GPIB_PRIMARY_ADDR
        • VI_ATTR_GPIB_READDR_EN
        • VI_ATTR_GPIB_RECV_CIC_STATE
        • VI_ATTR_GPIB_REN_STATE
        • VI_ATTR_GPIB_SECONDARY_ADDR
        • VI_ATTR_GPIB_SRQ_STATE
        • VI_ATTR_GPIB_SYS_CNTRL_STATE
        • VI_ATTR_GPIB_UNADDR_EN
        • VI_ATTR_IMMEDIATE_SERV
        • VI_ATTR_INTF_INST_NAME
        • VI_ATTR_INTF_NUM
        • VI_ATTR_INTF_PARENT_NUM
        • VI_ATTR_INTF_TYPE
        • VI_ATTR_INTR_STATUS_ID
        • VI_ATTR_IO_PROT
        • VI_ATTR_JOB_ID
        • VI_ATTR_MAINFRAME_LA
        • VI_ATTR_MANF_ID
        • VI_ATTR_MANF_NAME
        • VI_ATTR_MAX_QUEUE_LENGTH
        • VI_ATTR_MEM_BASE/VI_ATTR_MEM_BASE_32/VI_ATTR_MEM_BASE_64
        • VI_ATTR_MEM_SIZE/VI_ATTR_MEM_SIZE_32/VI_ATTR_MEM_SIZE_64
        • VI_ATTR_MEM_SPACE
        • VI_ATTR_MODEL_CODE
        • VI_ATTR_MODEL_NAME
        • VI_ATTR_OPER_NAME
        • VI_ATTR_PXI_ACTUAL_LWIDTH
        • VI_ATTR_PXI_BUS_NUM
        • VI_ATTR_PXI_CHASSIS
        • VI_ATTR_PXI_DEST_TRIG_BUS
        • VI_ATTR_PXI_DEV_NUM
        • VI_ATTR_PXI_DSTAR_BUS
        • VI_ATTR_PXI_DSTAR_SET
        • VI_ATTR_PXI_FUNC_NUM
        • VI_ATTR_PXI_IS_EXPRESS
        • VI_ATTR_PXI_MAX_LWIDTH
        • VI_ATTR_PXI_MEM_BASE_BAR0/1/2/3/4/5
        • VI_ATTR_PXI_MEM_SIZE_BAR0/1/2/3/4/5
        • VI_ATTR_PXI_MEM_TYPE_BAR0/1/2/3/4/5
        • VI_ATTR_PXI_RECV_INTR_DATA
        • VI_ATTR_PXI_RECV_INTR_SEQ
        • VI_ATTR_PXI_SLOT_LBUS_LEFT
        • VI_ATTR_PXI_SLOT_LBUS_RIGHT
        • VI_ATTR_PXI_SLOT_LWIDTH
        • VI_ATTR_PXI_SLOTPATH
        • VI_ATTR_PXI_SRC_TRIG_BUS
        • VI_ATTR_PXI_STAR_TRIG_BUS
        • VI_ATTR_PXI_STAR_TRIG_LINE
        • VI_ATTR_PXI_TRIG_BUS
        • VI_ATTR_RD_BUF_OPER_MODE
        • VI_ATTR_RD_BUF_SIZE
        • VI_ATTR_RECV_INTR_LEVEL
        • VI_ATTR_RECV_TRIG_ID
        • VI_ATTR_RET_COUNT/VI_ATTR_RET_COUNT_32/VI_ATTR_RET_COUNT_64
        • VI_ATTR_RM_SESSION
        • VI_ATTR_RSRC_CLASS
        • VI_ATTR_RSRC_IMPL_VERSION
        • VI_ATTR_RSRC_LOCK_STATE
        • VI_ATTR_RSRC_MANF_ID
        • VI_ATTR_RSRC_MANF_NAME
        • VI_ATTR_RSRC_NAME
        • VI_ATTR_RSRC_SPEC_VERSION
        • VI_ATTR_SEND_END_EN
        • VI_ATTR_SIGP_STATUS_ID
        • VI_ATTR_SLOT
        • VI_ATTR_SRC_ACCESS_PRIV
        • VI_ATTR_SRC_BYTE_ORDER
        • VI_ATTR_SRC_INCREMENT
        • VI_ATTR_STATUS
        • VI_ATTR_SUPPRESS_END_EN
        • VI_ATTR_TCPIP_ADDR
        • VI_ATTR_TCPIP_DEVICE_NAME
        • VI_ATTR_TCPIP_HOSTNAME
        • VI_ATTR_TCPIP_KEEPALIVE
        • VI_ATTR_TCPIP_NODELAY
        • VI_ATTR_TCPIP_PORT
        • VI_ATTR_TERMCHAR
        • VI_ATTR_TERMCHAR_EN
        • VI_ATTR_TMO_VALUE
        • VI_ATTR_TRIG_ID
        • VI_ATTR_USB_ALT_SETTING
        • VI_ATTR_USB_BULK_IN_PIPE
        • VI_ATTR_USB_BULK_IN_STATUS
        • VI_ATTR_USB_BULK_OUT_PIPE
        • VI_ATTR_USB_BULK_OUT_STATUS
        • VI_ATTR_USB_CLASS
        • VI_ATTR_USB_CTRL_PIPE
        • VI_ATTR_USB_END_IN
        • VI_ATTR_USB_INTFC_NUM
        • VI_ATTR_USB_INTR_IN_PIPE
        • VI_ATTR_USB_INTR_IN_STATUS
        • VI_ATTR_USB_MAX_INTR_SIZE
        • VI_ATTR_USB_NUM_INTFCS
        • VI_ATTR_USB_NUM_PIPES
        • VI_ATTR_USB_PROTOCOL
        • VI_ATTR_USB_RECV_INTR_DATA
        • VI_ATTR_USB_RECV_INTR_SIZE
        • VI_ATTR_USB_SERIAL_NUM
        • VI_ATTR_USB_SUBCLASS
        • VI_ATTR_USER_DATA/VI_ATTR_USER_DATA_32/VI_ATTR_USER_DATA_64
        • VI_ATTR_VXI_DEV_CLASS
        • VI_ATTR_VXI_LA
        • VI_ATTR_VXI_TRIG_STATUS
        • VI_ATTR_VXI_TRIG_SUPPORT
        • VI_ATTR_VXI_VME_INTR_STATUS
        • VI_ATTR_VXI_VME_SYSFAIL_STATE
        • VI_ATTR_WIN_ACCESS
        • VI_ATTR_WIN_ACCESS_PRIV
        • VI_ATTR_WIN_BASE_ADDR/VI_ATTR_WIN_BASE_ADDR_32/VI_ATTR_WIN_BASE_ADDR_64
        • VI_ATTR_WIN_BYTE_ORDER
        • VI_ATTR_WIN_SIZE/VI_ATTR_WIN_SIZE_32/VI_ATTR_WIN_SIZE_64
        • VI_ATTR_WR_BUF_OPER_MODE
        • VI_ATTR_WR_BUF_SIZE
      • Events
        • Events
        • VI_EVENT_ASRL_BREAK
        • VI_EVENT_ASRL_CHAR
        • VI_EVENT_ASRL_CTS
        • VI_EVENT_ASRL_DCD
        • VI_EVENT_ASRL_DSR
        • VI_EVENT_ASRL_RI
        • VI_EVENT_ASRL_TERMCHAR
        • VI_EVENT_CLEAR
        • VI_EVENT_EXCEPTION
        • VI_EVENT_GPIB_CIC
        • VI_EVENT_GPIB_LISTEN
        • VI_EVENT_GPIB_TALK
        • VI_EVENT_IO_COMPLETION
        • VI_EVENT_PXI_INTR
        • VI_EVENT_SERVICE_REQ
        • VI_EVENT_TRIG
        • VI_EVENT_USB_INTR
        • VI_EVENT_VXI_SIGP
        • VI_EVENT_VXI_VME_INTR
        • VI_EVENT_VXI_VME_SYSFAIL
        • VI_EVENT_VXI_VME_SYSRESET
      • Operations
        • Operations
        • viAssertIntrSignal
        • viAssertTrigger
        • viAssertUtilSignal
        • viBufRead
        • viBufWrite
        • viClear
        • viClose
        • viDisableEvent
        • viDiscardEvents
        • viEnableEvent
        • viEventHandler
        • viFindNext
        • viFindRsrc
        • viFlush
        • viGetAttribute
        • viGpibCommand
        • viGpibControlATN
        • viGpibControlREN
        • viGpibPassControl
        • viGpibSendIFC
        • viIn8/viIn16/viIn32/viIn64
        • viIn8Ex/viIn16Ex/viIn32Ex/viIn64Ex
        • viInstallHandler
        • viLock
        • viMapAddress/viMapAddressEx
        • viMapTrigger
        • viMemAlloc/viMemAllocEx
        • viMemFree/viMemFreeEx
        • viMove/viMoveEx
        • viMoveAsync/viMoveAsyncEx
        • viMoveIn8/viMoveIn16/viMoveIn32/viMoveIn64
        • viMoveIn8Ex/viMoveIn16Ex/viMoveIn32Ex/viMoveIn64Ex
        • viMoveOut8/viMoveOut16/viMoveOut32/viMoveOut64
        • viMoveOut8Ex/viMoveOut16Ex/viMoveOut32Ex/viMoveOut64Ex
        • viOpen
        • viOpenDefaultRM
        • viOut8/viOut16/viOut32/viOut64
        • viOut8Ex/viOut16Ex/viOut32Ex/viOut64Ex
        • viParseRsrc
        • viParseRsrcEx
        • viPeek8/viPeek16/viPeek32/viPeek64
        • viPoke8/viPoke16/viPoke32/viPoke64
        • viPrintf
        • viQueryf
        • viRead
        • viReadAsync
        • viReadSTB
        • viReadToFile
        • viScanf
        • viSetAttribute
        • viSetBuf
        • viSPrintf
        • viSScanf
        • viStatusDesc
        • viTerminate
        • viUninstallHandler
        • viUnlock
        • viUnmapAddress
        • viUnmapTrigger
        • viUsbControlIn
        • viUsbControlOut
        • viVPrintf
        • viVQueryf
        • viVScanf
        • viVSPrintf
        • viVSScanf
        • viVxiCommandQuery
        • viWaitOnEvent
        • viWrite
        • viWriteAsync
        • viWriteFromFile
      • Resources
        • Resources
        • VISA Resource Template
        • VISA Resource Manager
        • INSTR Resource
        • MEMACC Resource
        • INTFC Resource
        • BACKPLANE Resource
        • SERVANT Resource
        • SOCKET Resource
        • RAW Resource
      • Status Codes
        • Completion Codes
        • Error Codes
    • Platform-Specific and Portability Issues
      • Programming Considerations
        • Multiple Applications Using the NI-VISA Driver
        • Low-Level Access Functions
        • Interrupt Callback Handlers
      • Multiple Interface Support Issues
        • VXI and GPIB Platforms
        • Serial Port Support
          • C Example
          • Visual Basic Example
        • VME Support
    • Glossary
    • Important Information
      • Warranty
      • Copyright
      • Trademarks
      • Patents
      • Warning Regarding Use of NI Products
    • Technical Support and Professional Services

Get in touch

Submit feedback about this site to:

  • [email protected]

© documentation.help. Design: rehmann.co.