The VIs and functions on the Event Handling palette handle VISA events. To handle VISA events, you must enable event queuing with the VISA Enable Event function. Queues work per session and per event type, so you must enable queuing on every session for which you want to handle events.
Use the VISA Wait on Event function to retrieve events from a queue. If an event of the specified type already has occurred, calling VISA Wait on Event returns that event immediately, regardless of the value you set for the timeout parameter.
You also can use VISA Wait on Event to wait for events that currently do not exist in the queue. Execution stops until an event of the specified type arrives or until the VISA Wait on Event function times out. Set a reasonable timeout value to wait for events that currently do not exist in the queue.
Tip To check if the queue contains any events of the type you specified, set timeout on the VISA Wait on Event function to 0 (immediate). |
When the VISA Wait on Event function returns an event, the event no longer exists in the queue for the session on which you invoked the wait operation. However, if event queuing is enabled on any other VISA session, the event remains in the queue for that session until it is retrieved.
Use the VISA Disable Event function to disable event queuing on a specific VISA session. When you call this function, no additional events are added to the queue for the session. However, the queue retains any events that already existed in the queue. You can either retrieve or discard these events. To retrieve the events, use the VISA Wait on Event function. To discard the events, use the VISA Discard Events function.
The default length of VISA event queues is 50. If the queue is full and a new event arrives, the new event is discarded. Event queues in VISA do not grow dynamically, but you can use the General Settings:Maximum Queue Length property to change the size of an event queue programmatically. If you change the queue length on a given session, you must do so before VISA Enable Event is called for the first time.
The following table lists the events you can handle with these VIs and functions. This table includes a description of each event along with its supported resource classes, such as GPIB, PXI etc.
Note The serial events are valid only on Windows and platforms on which National Instruments supports its ENET-Serial products. |
Event Name | Description | Resource Classes | ||
---|---|---|---|---|
Service Request | Notifies the application that a service request was received from the device or interface associated with the given session.
| GPIB INSTR, GPIB INTFC, GPIB-VXI INSTR, TCPIP INSTR, USB INSTR, VXI INSTR | ||
Trigger | Notifies the application that a trigger interrupt was received from the device. This may be either a hardware or software trigger, depending on the interface and the current session settings. | GPIB INTFC, VXI INSTR, VXI BACKPLANE, VXI SERVANT | ||
Clear | Notifies the application that a device clear message was sent to the local controller. | GPIB INTFC, VXI SERVANT | ||
VXI Signal | Notifies the application that a VXIbus signal or VXIbus interrupt was received from the device associated with the given session. | VXI INSTR | ||
VXI/VME Interrupt | Notifies the application that a VXIbus interrupt was received from the device associated with the given session. | VXI INSTR | ||
VXI/VME Sysfail | Notifies the application that the VXI/VME SYSFAIL* line was asserted. | VXI BACKPLANE | ||
VXI/VME Sysreset | Notifies the application that the VXI/VME SYSRESET* line was asserted. | VXI BACKPLANE, VXI SERVANT | ||
GPIB CIC | Notifies the application that the GPIB controller has gained or lost CIC (controller-in-charge) status. | GPIB INTFC | ||
GPIB Talk | Notifies the application that the GPIB controller was addressed to talk. | GPIB INTFC | ||
GPIB Listen | Notifies the application that the GPIB controller has been addressed to listen. | GPIB INTFC | ||
PXI Interrupt | Notifies the application that a PXI interrupt occurred. | PXI INSTR | ||
USB Interrupt | Notifies the application that a USB interrupt has occurred. | USB INSTR, USB RAW | ||
Serial Break | Notifies the application that a break signal was received. | Serial INSTR | ||
Serial TermChar | Notifies the application that the termination character was received. The actual termination character is specified by setting the Message Based Settings:Termination Character Enable property prior to enabling this event. For this event, the setting of the Message Based Settings:Termination Character Enable property is ignored. | Serial INSTR | ||
Serial CTS | Notifies the application that the Clear To Send (CTS) line changed state. If the CTS line changes state quickly several times in succession, not all line state changes necessarily result in event notifications. | Serial INSTR | ||
Serial DSR | Notifies the applications that the Data Set Ready (DSR) line changed state. If the DSR line changes state quickly several times in succession, not all line state changes necessarily result in event notifications. | Serial INSTR | ||
Serial DCD | Notifies the application that the Data Carrier Detect (DCD) line changed state. If the DCD line changes state quickly several times in succession, not all line state changes necessarily result in event notifications. | Serial INSTR | ||
Serial RI | Notifies the application that the Ring Indicator (RI) input signal was asserted. | Serial INSTR | ||
Serial Character | Notifies the application that at least one data byte has been received. Each data character does not necessarily result in an event notification. In other words, if multiple data bytes arrive at once, you may get only one event. After receiving this event, use the Serial Settings:Number of Bytes at Serial Port property to query the serial port for the number of bytes available. | Serial INSTR |