several structures of event in a VI

I have two event structures in a single VI, which handles the events that freeze the user interface and the other for events that are not. This last group is all triggered acquisition tasks, where arm you data acquisition, but maybe can abandon it (or do other things, while waiting for the data to come. Of course, you need a stop button to be active and responsive. With hindsight, using two loops was perhaps a bad choice, but one that I did because it never occurred to me that these things would be only after the fire and should be put in a while loop to be kept active. No other language not as I know. Anyway, the question is how can I keep the two assets? I surround both in a single while loop? Can I give each their own while loop. Can I give up and merge the structures of two events into one. For clarity, I would like to separate them, but this is not essential. I ' LD would like to know what are my options.

Rossu says:

If they are sperate while loops will be they have both run. If they are in a loop the loop recycling if a structure is still waiting for an event?

The answer to this is fundamental to the work of LabVIEW. A loop will not proceed to the next round until the end of everything inside. If you have two event structures in the same loop, two of them need to deal with an event (or a timeout) before the will of loop iterate.

You can have several event facilities in the same VI.

By 'freeze the user interface,' do you mean the 'Blocking façade...' box "in the case of dialogue? There is no problem to have some events that can I lock the Panel front and some that are not in the same structure of the event. I'm not sure that's what you mean by 'freeze' the UI, however.

EDIT: and comment more. Generally, you should not put long tasks (such as data acquisition) within a structure of the event. Instead, the case of the event should pass these tasks to a separate loop (for example, by using a queue) so that the structure of the event can quickly return to listen for other events.

Tags: NI Software

Similar Questions

  • several structures of event

    Experts,

    No harmful effect of having two event Structures, one in the main BD delivery of user interface events (button presses, menu etc.), another running into a Subvi loop, handle events of the user?

    My reason for doing is also blocking calls UI (like brining a dialogue password entry) could not be paid directly to the event Structure. I use the user events (and thus a corresponding event Structure) as the basis of a periodic Task Scheduler and my tasks get unmanaged queued properlyif something blocks the Structure of the event.

    Of course, I would be careful that there is no common event between the two structures. This would be easier, due to the nature of the Subvi in the event user manages the Structure of the event.

    Thoughts?

    Nothing inherently wrong to have multiple structures of event. Our application tend to have dozens and dozens at the same time, due to the fact that the user events, while demanding a bit of wiring and infrastructure, are incredibly useful things.

    The main caveats are:

    1. If you subscribe to a user event, wire the event record Refnum to more than one Structure of the event, or the behavior is undefined. Sometimes, one or more of the event structures don't receive the event. Instead, register the event several times, one for each structure of the event.

    2. As Ben said, save more than once for the same event of filter.

    Another easy way to circumvent the problem of blocking dialogue would be to create another loop whose sole responsibility is to pop up dialog boxes blocking. You can use a queue or user events or else send messages to and from this loop. A single loop should be enough, especially if the pop ups are modal and could only be active anyway. To be honest, I've never had to do this, but it seems it would work very well.

  • Unexpected behavior with several structures of events manages the event itself.

    Hi, does anyone have an explanation of the following behavior?

    After 'Boolean 2' is enabled and then disabled the program "freezes". You can always pause the program but nothing does.
    For example, by pressing one of the file, Edit, View, project, Operate, tools, Windows, help or any other object inside the VI.

    This happens if I have two event structures who want to handle the same event, even if the flat sequence should be allowed only one run.

    This isn't a bug.

    Structures of the event should be used to handle different events. Given that you have entered your Boolean event in the two structures of the event, the event gets queued both when it occurs. This means one or the other be expected to manage the event and will, by default, lock the application. In the scale-measure of LabVIEW architectures, usually there is a structure of single event that handles all the events and then sends messages to the coast to the rest of the application to manage these events.

    There is a "Table locking" checkbox in the event dialog box which is by default enabled, but you should leave it on because it leads to bad practices otherwise.

  • Can I have several structures with the same case of event event?

    Hello

    I do an application which reproduces the front of the power supply HP6675A. To do this, I did a machine to States with different States

    (initialize, measures, voltage, current, ocp, ov, store, recall, etc.). In each State, should have a structure of the event that attracts the events of the buttons, as for example: If the current state is the voltage mode and the current button is pressed the next State will be the current mode. For this purpose in each State of the state machine should be the same structure of event with the same events.

    My problem is that the Vi does not work properly when I have several structures with the same case of event event. There are some possibly to do and how? Or is impossible to have several events? I read a few posts, but I can't find solutions.

    Any help is appreciated.

    Thank you very much.

    In general, you should have 1 structure of the event in your VI.  In your state machine, the structure of the event should be in "pending" status  So you will probably start in the State of the initialization and then spend idling.  Then, the user presses the present button.  If your state machine should then, go to the current state and then return to Idle.

  • Copy a structure of event containing local variables

    Hello

    I am a state machine design in Labview and next state transition logic to wait be clicked a few buttons on the Panel.

    If I press a Boolean button from 1 to 9, next State should be X, otherwise condition (10 to 16 tags) should be there.

    I thought that the right approach, because it would be a structure of the event, where I added two cases: case 1 (button 1: mouse to the bottom button 2 down,..., 9 of the mouse down) and box 2 (10 mouse buttons down,...). For each of these cases, I'm reading & writing the local variable of some double digital.

    When I copy the structure of the event in another case of structure of outer case, I note the following: all cases in the event loop is missing, and the local variable renamed automatically and a new created indicator digital.

    • How to make an exact copy of the structure of the event, without the problems described above?
    • Could you suggest a different approach more effective than mine?

    Thanks for any response.

    Start by reading the guard and recommendations for using events in LabVIEW - LabVIEW 2011 help

    The fact that you try to copy and structure of the event to another, and that a structure of the event will be buried in a case initially tells me you are already heading on the wrong track and yourself in creating a world of problems.  Your architecture will never seem to work for you.

    The event structures are always active and capture events.  Even when the structure of the event is not in the path of execution, it's queue of events to which he attributed to him.  If you have events that are set to lock the façade until full, then you're really screwed because the event structure will capture the event, locking of the front panel and the execution path of your code with the state machine may never come to the specific case that has captured the event to support then release the façade.

    In general, you should have the structure of a single event in a VI, and should not be buried in a case structure where he can never carry.  You also shouldn't have several event facilities manage the same events.   These are not hard and fast rules, but until you are quite familiar with how the event structures work and completely understand the architecture of your code, you should not violate or you will just ask trouble.

    Similarly with the help of local variables.  The fact that you say that you have local variables and you try to copy tells me that you already have too many.  There is certainly a better way to build your VI, which does not require local variables with the exception of a few cases and certainly won't need several structures event buried in the structures of the case.

    You should probably have a producer/consumer architecture that handles the events.  Have a simple loop with a structure of the event which captures all user interactions.  Pass events to a loop of consumer who is also your computer through a queue of State.  (Also known as a computer state in queue or the BAU).  Let the state machine to determine how to manage the events, he received based on what is the current state of the VI.

  • Why two structures parallel event influence each other

    I have a puzzle on the execution of two parallel event structures. See instant attachment and vi.

    The two structures parallel event sit in two different while loops. During the event "mouse down" arrives on numeric1, it will take 10 s waiting in this case. Meawhile, if the "mouse down" event that happens on numeric2, does not respond before the end of the first case of event structure "mouse down".

    This mechanism seems against the parallet operate the mechanism because the two same-while loops has no relationship.

    Thank you.

    WT

    weitong wrote:

    I have a puzzle on the execution of two parallel event structures. See instant attachment and vi.

    The two structures parallel event sit in two different while loops. During the event "mouse down" arrives on numeric1, it will take 10 s waiting in this case. Meawhile, if the "mouse down" event that happens on numeric2, does not respond before the end of the first case of event structure "mouse down".

    This mechanism seems against the parallet operate the mechanism because the two same-while loops has no relationship.

    Thank you.

    WT

    What is happening is very correct depending on the configuration. If you want to get what you want, go to the structure of the event 1 "edit the tΓche" and uncheck the option "Cover Lock".

  • create subroutines for several structures of the event and common stop button

    Hi guys,.

    I wonder if there is a better way to design algorithm below scenerio that similar technical rehearsal for each structure of the event.

    Please find in annex vi where I designed the code to a boolean (D). I want to design a similar code for all other bolleans. (In the present design code, photo is displayed when the mouse is flown over D). I obviously have other pictures for the other,(A,B,C,E,F) booleans. Can we have a kind of subroutines for other Boolean types and a single stop for all the application button.

    Thank you very much in advance for your support.

    Sorry (I forgot to add vi) Please find attached.

  • structure of event using read indicator labview

    Hello
    I would like to be able control the light using the structure of the event.
    I use with block serial reading and analyze the string. When he acknowledged the string must change the State of the LED each time.
    Please let me know if it is possible and how I can exec who?
    Please find attached the file VI.
    For example I would like it when the string "Door open!" is displayed it must change the State of the LED.
    Thanks for any help,

    This isn't to make the event Structure is used.  An event Structure is used to capture GUI events, as a user presses a button or changes the value of a control.

    If you want just the value to toggle, using a shift register to store the current value.  If you find the right chain, toggle (using the NOT function).

  • Several cases of event refer to the same graphic image

     

    I try to use different events like button clicks to trigger a different events that all will always use the same graph (an image from a camera). Is there a simple way to do this? I work through the training videos, but it doesn't seem to appear.

     

    Thank you

    See below for a clearer question

    StephenHoltz wrote:

    It just makes a new chart each time instead.

    What is 'he' who does that?

    If the graph of the intensity is shared by all cases, its terminal belongs just after the structure of case or event.

    You can attach a simplified VI which shows what you're trying to do?

  • Behavior of structure the event when a property of the control is changed

    Hello

    Is the normal operation of VI attached? Why the change of ownership of a random control would affect the behavior of an event structure?

    THX

    Don't don't never use a structure of the event within a structure of the event.

    Reading guard and recommendations when using events in LabVIEW

    What you saved to lock the hard VI, is that you turned off the setting of Panel lock before your event to their default value being checked.

    The reason why he reacts this way is that the component: the mouse to the top of the event occurs when you go and click on the toggle.  So as soon as you mouse down on the chain, this internal event structure already as the pane: mouse event queue to the top and runs immediately.

    (In fact, that while loop is useless because the while loop can execute only once.)

  • Problems of Structure of event

    Hi all

    I'm using the following code tries to get the tension and then use the peak voltage to trigger an event. My event structure is not working properly and I'm not sure what I'm supposed to do.

    Take a look, and any help would be great!

    Hey,.

    There are a number of things wrong with your layout, another that the Structure of the event is not called. What you have here is not a lot and that's the beauty of LabVIEW: you can do the same thing in different ways.

    Following the design of the Structure of the event, you intend to go with, I have attached a redesign of your code, including comments. I think this should work for you now. I followed the common approach of the Machine State, which uses perfectly, the Structure of the event - when in "stable" condition or non-working.

    The main aspect that you need to consider is how the Structure of the event is called. He needs a break to identify a State he needs to address. In this case, to increment a counter each time that the peak voltage is detected.

    The enumerated data type (the value that keeps the State of the States-transitions diagram) can be added to or changed. Normally, you should 'Customize... '. "the type of data (right-click) and create a variable of Type Def (ensures all the changes in the code, where it is used).

    There is more you can do with this structure, it is quite useful and powerful. There are a few examples online or within the help function in LabVIEW to give you more. Regarding the DAQmx, there is a project of State machine already set up for you - with all type defs and some events already created for you. After you have mastered this you must go along and check out more.

    All the best. David.

  • Subvi inside the structure of event wont run a second time.

    I have a Subvi within a structure of the event, and it runs when I press a button, inside the Subvi is code in a while loop, and when the last piece of code is executed, the while loop stops.  I have a bad event triggerring once I have already run once.  Which means that I pressed the button and the code in the event structure was executed and while the main VI works always, I press the same button again and everything works but the Subvi.  How I would do this job?


  • Mass changing the structures of events

    I have a VI in which I am coding a drag and drop events. The front panel has more than 200 indicators and Boolean values in which I want to make it able to accept a decrease from an event drag. My problem is the time it takes to change the structure of the event for all controls, one by one. Does anyone know how to change mass event structures quickly? Unfortunately I can't figure a way to do a drop with references to component event.

    There may be a way to do it using LabVIEW to script to automate the creation of a more complicated case of event.

    But you can try using the user events.  Use of control references tables introduced in a loop For to register for events on each control changing value.  Then you have a case of user event in the structure of the event which manages it.  If you dynamically build your event programmatically while running your VI, rather than do it manually by manipulating the event dialog boxes.

  • The Panel buttons before manipulation within a structure of event

    Is there an easy way to manage buttons on the front panel within a structure of the event? I am currently using a structure of the event to bring up a settings tab, but I can only use the buttons that are designated as events. Is it possible to use non-event buttons to perform a sequence of installation and calibration within a structure of the event?

    I'm not sure that understand your question. From what you describe, you should look into an architecture of producer consumer where your event loop receives an event, and then transfers part of the work to do in the loop of consumption. This keeps your event loop free to receive events. LabVIEW 2012 comes with a good example of this, the message queue manager model project of waiting.

  • Looking for an explanation of the flow of data around a structure of event with data going in and coming out of it

    I am trying to add a case to the structure of the event shown below.  Other cases in the event structure close the front afterwards.  I wish my case in abeyance the façade.  Is it possible to do it with this configuration?

    Because the invoke method is in front of the structure of the event what it means that the Panel should be open whenever the structure of the event begins to look for an event?

    The structure of the event by using the code below, after I pressed the button calibrate stop listening to additional events.  I moved the functions close FP within the structure of the event, so other events he would call here but this does not seem to make a difference.

    Thanks for any help.

    Dave

    An event structure only waiting for an event.  To continue waiting for the events after the first occurs, you must put the event structure within a while loop.  Then you can put your knot FP close outside while loop and thread the stop of the while loop condition for the loop stops for the case that you want to close your façade.

Maybe you are looking for