LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating custom user event. Event more suited for this situation than occurences or notifiers?

Okay, Heres my situation. I have lets say 4 windows which plot data from a common data source. Now I only want the data read and displayed on the graph when an aquire button is pressed on one of the graph. So data is constantly aquired by only added to the array connected to the graphs on each form until the 1 aquire button is being pressed.

I was thinking the best way todo this would be for the one form with the aquire button to raise an event that would cause all the other forms to grab the data point. I was thinking an event loop because the user can manipulate the graph window and to prevent polling I thought an event loop would be the best. I figure I could use o
ccurences but again that would cause polling. I could use notifiers because I think that would allow me to send the data point with the notification but again i think there would still be polling.

Does anyone have any examples or easy instructions how to raise an event that I have created? Do you think this is the best way to handle this situation?

Thank you for taking the time to think about this long winded question.
0 Kudos
Message 1 of 5
(2,832 Views)
I am not sure I completely understand the application, however I think your best bet would be notifiers.

Take a look at the attached VIs. I am using the notifier to pass data from the main VI to the 2 SubVIs. By using Wait on Notification I do not have to poll at all. In addition I used the event structure in the main VI so I would not have to poll for the button press either.

I hope this helps.

Evan
National Instruments
Download All
0 Kudos
Message 2 of 5
(2,832 Views)
> thought an event loop would be the best. I figure I could use
> occurences but again that would cause polling. I could use notifiers
> because I think that would allow me to send the data point with the
> notification but again i think there would still be polling.
>
> Does anyone have any examples or easy instructions how to raise an
> event that I have created? Do you think this is the best way to
> handle this situation?
>


There are several approaches. If you are already using an event
structure, you can define and register a user event. Another approach
is to use the occurrence, notifier, queue, etc. You mention this is
polling, but technically these nodes block execution, so unless you have
a timeout, these nodes stop execution until tr
iggered just like an event
structure.

Greg McKaskle
0 Kudos
Message 3 of 5
(2,832 Views)
Can I define and register a user event on one VI and have the other VIs pick it up in their event structure?
0 Kudos
Message 4 of 5
(2,832 Views)
> Can I define and register a user event on one VI and have the other
> VIs pick it up in their event structure?

Yes. You need to arrange for the two VIs to be given the same user
event refnum. You might want to open
examples/general/dynamicEvents.llb/Programmatically Fire Events.vi and
look at how it works. You create the event refnum and wire its value to
both the event registration and to the location that will fire the
event. You can use globals or other things to get the value around if
you are careful, but it would better to put it in the caller of the two VIs.

Greg McKaskle
0 Kudos
Message 5 of 5
(2,832 Views)