This site uses cookies to bring you the best experience. Find out more
Skip to main content

blog

LabVIEW Tip - LabVIEW User Events

This post gives an introduction to user events and a tip when implementing them in your applications.

User events are a really effective method for passing messages on a one to many basis within a LabVIEW architecture. They’re really simple to setup with two main aspects, creation and registration and generation.

Creating and registering for user events

There are three main steps for creating and registering for user events, where the numbers below relate to the numbers in the image;

  1. Use the Create User Event LabVIEW function to define a new user event and configure the data type that will be sent when this user event is triggered.
  2. Use the Register for User Event LabVIEW function to register the created events. Dragging down the Reg Events node will enable multiple user events to be registered using a single node.
  3. Use the Event structure as the endpoint for the generated user events. The label of the data constant defined in 1 will be used to name the case relating to the user event.

Generating user events

Referring to item 4 in the block diagram above, generating user events is as simple as calling the Generate User Event function, connecting the event that you want to generate and defining the data that you want to send.

The tip when implementing user events into you applications is to ensure you wire up the Dynamic Event Terminals, which can be made visible by right clicking on the Event Structure. Also, if you are using LabVIEW 2012 or earlier you must ensure that you handle all events that you register for with an event structure case. If you don’t, you risk running into memory issues when generating the user events. This is because the generation of the user event consumes memory and if you don’t release that memory through the event structure handling, that memory will stay allocated to the user event.

If you’re looking to take it a step further, check out dynamic registering of events, you can register user events against things like mouse enter or mouse leave.

Argenta host a User Group three times a year focused on LabVIEW and based in the Midlands. If you’d like to discuss your LabVIEW challenges, either come along to the user group or get in touch.

 

Back to Blog listings

ARGENTA IS A LEADING PROVIDER OF PRODUCT RELIABILITY AND PROCESS IMPROVEMENT SOLUTIONS.

Call 0121 514 2290 to discuss your requirements