Example Code

Register VISA Event as Top Level Event Using a User Event Structure

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

    Driver

  • NI VISA

Code and Documents

Attachment

Overview
The following example demonstrates a method for translating VISA event handling to a top-level user event structure.


Description 

This program demonstrates a method for translating VISA event handling to a top-level user event structure. Using application control methods, VISA events may be extracted and registered at the user level; such that, program execution may be triggered by events within VISA hardware on the system.

 

Requirements

  1. LabVIEW 2012 or later
  2. NI-VISA Driver

 

Steps to Implement or Execute Code

 

  1. Configure the Serial Port
  2. Enable the VISA Event of your choice.
  3. Create a User Event to associate the VISA event with.
  4. Register for the User Event, when it is fired.
  5. Use a User Event Structure to handle dynamically generated User Defined Events.
  6. Wait for the VISA Event to occur.
  7. Assign the VISA event status, to a Generated User Event
  8. The second event case monitors for the User Event, and will execute when it is fired.
  9. Close the VISA Resource.

 

Additional Information or References

VI Snippet

11111.png

 
 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
_Xilinx_
Member
Member
on

The "Service-Request"-event selected by default did not work for my ordinary COM-port!

"Serial character"-event Type does work!

denibel
Member
Member
on

Bad solution. The good one does not exist, because "Visa event" is not an "Event".

Ting1224
NI Employee (retired)
on

Hi denibel,

I agree with you. It seems that this example still utilizes polling instead of real event scenario.

Do you have any better solution for registering VISA event as a top level user event?

Steve_Block
Active Participant
Active Participant
on

To be more specific about the previous two poster's comments, I'm looking to not only register that the event occurred, but also have the data and timestamp included in the event buffer.