01-09-2015 09:17 AM
hello,
I found this example:
http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/dynamic_modifying_reg/
I want to do the same thing, except that it's not the mouse move event that I want to toggle (register/unregister) but the timeout event.
The timeout is in the drop down list of events I can register for, but it is greyed out.
How can I do this?
thanks
Solved! Go to Solution.
01-09-2015 09:24 AM
Use a shift register to hold what your timeout should be. Use -1 for never time out. Wire the value in the shift register to the timeout input on the Event Structure.
01-09-2015 03:26 PM
I was able for forceably change the dynamic event registration to "Timeout" despite being grayed out, but the code didn't work. The timeout event never occurs.
01-12-2015 04:10 AM
That doesn't work.
When I set the value to -1, the event runs into a dead lock, because the shift register cannot be updated without a running loop, but in order to run the loop, the shift register has to change the value.
I have two buttons to start/stop the timeout.
Two numeric outputs to display the current timeout time and the loop iterations (to check if the timeout is running).
Why is this so complicated?
Why is it not possible to register for the timeout dynamically like other events?
Why is the timeout listed in the drop down list but greyed out?
01-12-2015 04:51 AM
You are probably creating your own deadlock here...
Here is a small piece of code that works just fine for setting dynamically the timeout like crossrulz mentioned.
Regards,
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
01-12-2015 06:07 AM
Eric, thanks for trying to help me.
Please take a look at the image in my previous post.
The timeout event structure is in its own loop.
I'm not interested in a solution that has both timeout and other events within the same loop.
They should run in parallel.
01-12-2015 06:55 AM
@max_ wrote:
Eric, thanks for trying to help me.
Please take a look at the image in my previous post.
The timeout event structure is in its own loop.
I'm not interested in a solution that has both timeout and other events within the same loop.
They should run in parallel.
Sorrry, it is a solution, and not even a bad one 🙂
I would request your single timeout event, if you (just) need a timed structure, use a timed structure !
01-12-2015 07:43 AM
I'm sorry I had not seen the 2nd loop. Then what you have is a design issue. We traditionnally avoid using several event structures in parallel loops unless they properly handshake, and registering/unregistering events is certainly not a proper handshake 🙂
You will probably be better off using a queue communication with a selectable timeout on the Dequeue function. This will allow you to execute code based on messages sent from your "UI" event structure. And you will be able to send data with this instead of using variables.
If you can explain more what you're trying to do I could give you a more thorough insight.
--Eric
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
01-12-2015 07:54 AM
and registering/unregistering events is certainly not a proper handshake
Why is this not a proper way to do it?
I followed a tutorial from NI as you can see in the first post. Now I'm trying to apply that tutorial and suddenly it's not proper.
I chose this design because it'S pretty much exactly the same as in the tutorial.
I want to have a timeout running under certain conditions and not under others.
01-12-2015 08:11 AM
Use a User Event to send the new timeout time (either -1 to "unregister" or some other value to "register") from the first loop to the second loop, as shown below. I still have no idea why you would want to do this, but it will work fine.