04-16-2012 08:51 AM
I'm developing with Labview 2011 SP1
I have a loop with a stacked sequence. In two frames of the stacked sequence I have a while loop. In the every while loop I have an event-structure. What happens is that the first event-structure fire continuosly timeout hanging the VI.
If I delete the second event-structure the first works in the right way.
Have you suggestions to use the two event-structures?
I send the two files: the Automation_UI is the file not working, Automation_UI_old is the file with only one event-structure.
Thank you
Solved! Go to Solution.
04-16-2012 09:04 AM
I would suggest you to go though the basic coding guidelines and try to take examples from LabVIEW help. The way you coded is much confusing to understand this is normal with all the developers at the initial stage. Please make it simple and redo the code as fresh the present may bring issue later that you may not know.
Good luck.
04-16-2012 09:16 AM
Ok, never mind aboutt my code. It lacks of some sub-Vis. Is there some problems to insert two event-structures in two frames of the same stacked sequence? Even if do the two event-structures have the same events?
Let me know, please, before I rewrite entirely my code. In this way I can get aknoledgement
04-16-2012 09:23 AM
There will not be any problem if you have two event structures in two frames of stacked sequence because the frame 2 execution shows that there is nothing to do with frame 1 anymore so not a problem you can have. But its always easy to have only a single event structure or if you want it anyhow then make it inside a sub vi so for anyone who looks at the code will be clear to understand the way the code executes.
04-16-2012 09:23 AM - edited 04-16-2012 09:24 AM
Sorry tried to edit the post but got duplicated. NI should have the option for deleting the post
04-16-2012 09:31 AM
@P Anand wrote:
There will not be any problem if you have two event structures in two frames of stacked sequence because the frame 2 execution shows that there is nothing to do with frame 1 anymore so not a problem you can have. But its always easy to have only a single event structure or if you want it anyhow then make it inside a sub vi so for anyone who looks at the code will be clear to understand the way the code executes.
Not at all true! Having events in two separate sequences does nothing to change the fact that both event structures will always capture events. This is a basic understanding of event structures. Read the help on event structures - especially the 'caveats and recomendations for event structures'.
04-16-2012
09:35 AM
- last edited on
06-11-2025
01:37 PM
by
Content Cleaner
@FabioBone wrote:
Ok, never mind aboutt my code. It lacks of some sub-Vis. Is there some problems to insert two event-structures in two frames of the same stacked sequence? Even if do the two event-structures have the same events?
Actually, this is a very bad idea! Let me explain a bit.
In Frame A you have Event Structure X and in Frame B you have Event Structure Y both of whom handle event "Something". When "Something" occurs the event is added to the event queues of both X and Y WETHER OR NOT they are in an executing frame! So when Frame A executes it see that the event "Something" is in the queue and executes the event case. Same with Event Structure Y! "Something allready happened so that case will execute. This is almost assuredly not the desired operation and can be pretty difficult to debug.
Read the caveats on event usage and here
EDIT: I should type faster
04-16-2012 09:38 AM
@FabioBone wrote:
Ok, never mind aboutt my code. It lacks of some sub-Vis. Is there some problems to insert two event-structures in two frames of the same stacked sequence? Even if do the two event-structures have the same events?
Let me know, please, before I rewrite entirely my code. In this way I can get aknoledgement
In theory no but in practice it is very tricky as you have discovered.
When you get done erading all of the help topic suggested by the previous posters, you will eventually find out that normal event structures will register for the event as soo as the VI starts running AND events will by default have the property "Lock FP ..." set true.
So unless you thread the needle properly you will either lock due an event in a latter seq frame or due to an event in an earlier farme.
While you are doing you reading you should look for two subjects;
State Machine
Dynamic Event Registration.
A SM is the simplest solution becuase it will replace the seq structure with the SM which will allow you to return toa state with a single event structure.
The Dynamic Events is an advanced topic so try that one after you master the SM.
Just trying to help,
Ben
04-16-2012 09:40 AM
I've read the issue before the post I wrote.
It affirm that two event-structures in the same while loop could hang the panel, but it happens because the two structures are executed in the same time. In the case that I propose the stacked sequence could prevent the concurrent execution of the two event-structures.
Do you agree? Why the timeout event is fired continuosly in the first event-structure?
04-16-2012 09:43 AM
@FabioBone wrote:
Why the timeout event is fired continuosly in the first event-structure?
It will fire once for every timeout event that was enqueued while your other frames were being executed.