02-19-2020 08:35 AM
Hi
Am I right in thinking that the Event Structure timeout is reset every time a user event is handled by the event structure?
I assume so but wanted to check ...
Thanks
LV2015
Solved! Go to Solution.
02-19-2020 09:04 AM
Yes. A timeout is the event that occurs if no other event has happened during the timeout period.
02-19-2020 09:29 AM
Rephrasing slightly was RavensFan already stated:
The timeout event case is what is ran if there are no events in the event queue after the timeout counter has reached the desired timeout period. The timeout counter starts when the Event Structure is reached in the code.
02-19-2020 11:02 AM
Rephrasing slightly for clarity.
Yes. You are correct in that "the Event Structure timeout is reset every time a user event is handled".
02-19-2020 11:08 AM
In older versions of LabVIEW (I want to say 2011 and earlier) there was an interesting behavior. If you registered for an event, but didn't handle it (no corresponding event in the event structure), firing the event would still reset the timeout counter. Now it has changed, so only the handled events reset the timeout counter.
02-19-2020 11:27 AM
@Gregory wrote:
In older versions of LabVIEW (I want to say 2011 and earlier) there was an interesting behavior.
It was 2014 or 2015 where the events got a massive overhaul that fixed that behavior. I'm fairly certain it was 2014, but I am unable to find the NI Week presentation to prove it.
02-19-2020 12:48 PM
I found it was LV 2013 when the change occurred. Oddly, I found this in the LV 2014 upgrade notes
02-19-2020 01:15 PM - edited 02-19-2020 02:55 PM
If you want semi-regular timeout events happening, you can appropriately shorten the timeout whenever a non-timeout event occurs. ultimately, the timeout will be zero and it fires immediately if nothing else is queued up.
For a simple example, have a look at my post from 2005 (time files! :D).
(I would probably refresh that old code a little bit by placing most of the timeout regulation in an inlined subVI and also placing the ticker before the case structure, etc.)
EDIT: OK, here's an update version. Just a quick draft for now, but it could be turned into example code in the future (after review).
02-19-2020 01:31 PM
@Gregory wrote:
I found it was LV 2013 when the change occurred. Oddly, I found this in the LV 2014 upgrade notes
Yep, I found the presentation I was thinking of. It was during NI Week 2013. Jack Dunaway was giving a presentation of nuances of events and someone from NI R&D asked "Are you running 2012? That should be fixed in 2013." When digging through, I was thinking it was the year after he did that presentation that another presentation was one on events.
02-20-2020 09:21 AM
@Gregory wrote:
In older versions of LabVIEW (I want to say 2011 and earlier) there was an interesting behavior. If you registered for an event, but didn't handle it (no corresponding event in the event structure), firing the event would still reset the timeout counter. Now it has changed, so only the handled events reset the timeout counter.
It fixed it by unregistering the events in the Event Registration Refnum which are not handled. An unexpected side effect of this is that some of my existing code broke. I used event structures in series to piece-by-piece handle a large set of events, passing the Event Registration Refnum between them. This obviously does not work if all event queues for events not handled in the first event structure are discarded.
I suppose you could call it a "fix" but YMMV.