How to create a Structure of the event, repeating a task until a push a buttom

Hello!

I want to make a program that repeats a task until a push a buttom (indicating to begin another task). I know how to do this with a structure of the case, but I want to know how to deal with the event. Any idea?

OK, I'm going to help you a bit.

Here's how it works: the upper part (producer loop) will pass the value of the OK button (switch released) to the Message Handling loop (consumer).  When the button is true the consumer runs the code in the case of the real and enqueus another loyal to himself and then wait 1 second.  When the OK button is False, the value false is appeared on the front of the queue and the message handler runs if false, empty the rest of the queue and waits for the next message the event loop.

The Stop button (by releasing Latch) exits the event and the queue is destroyed causing the Dequeue return an error and leaves the message loop.

This is obviously an extremely simplified QMH.  To read up more about concepts go to file > Create Project > and click on the "More information" link

Tags: NI Software

Similar Questions

  • How to use a structure of the event in a Subvi

    I am using a structure of the event within a Subvi.  The Subvi has a table constructor that built tables and the structure of the event is used so that when the program runs, it allows you to change the elements of the array.  It works, but when I apply within a Subvi, it does not work properly.  This goes into a Subvi, because it will be part of a much larger progrram, so it must be modular.

    If you are using a structure of the event, it is not a Subvi.  If you worry about modularity, you should not use the structure of the event.

    You seem to have a fundamental misunderstanding of modularity.  An event structure must be placed in a while loop.  If you have a while loop in a Subvi, you have transferred control of your program to the Subvi.  You are not at this stage modular.  Your higher level GUI has no control.  You would have to create a stupid system of variables to pass data down to the loop to stop the loop and return to your main VI.  This is not a good design decision.

    Instead of searching for a way to make something broken, you should spend effort trying to understand what you really want to accomplish.  You should also spend some time to learn how to work the event structures.

    This application is small at the moment and it is already on the way to the unreadable.  It's a terrible thing to do for you.  Break these habits now.  variables are only when absolutely necessary.  Using subVIs to accomplish individual tasks, do not run the entire application.  With the structures of the event, use a value of stop button change event for will not be held hostage to the time-out.  If your variable is '2' in it, you're doing something wrong.  It has to be something different between set points, put it in the name.  If you want to make the subVIs, create an icon.

    But first and foremost, invest time in understanding dataflow

  • How to use a structure of the event with a state machine


    I don't know exactly what you're asking, but it sounds as if you want a bunch of script tests and if the user says stop, to immediately stop the current test and abandon others?  I'll assume you know how to clear the table so that it will not abandon the others, so I guess that you have wrong to abandon the current test?  If it is indeed the case, the problem is that you are not able to spread the message of the VI FP main which is the GUI for the sub vi which is the test where the test may or not have a GUI (FP visible) of its own.  Threading is the first thing to come to mind, but it will be may not need the use of events.

    You can do this by passing a refnum of the stop button to the Subvi, where you can then add to wait to the structure of business event.

    I have attached 2 screws, mainvi.vi which is just a loop displays the number * 2 (number of seconds since the race) to be called subvi.vi and then check to see if the button is pressed.  mainvi.VI is in no way a state engine, it's just a simple loop for demonstration purposes.  subvi.VI just waits 2 seconds and leaves, this is a better engine State structured with an init State to start a case of survey to wait events and an exit status to clean.  You can change everything as you wish so that he can do what you want.  You will notice that even if subvi.vi is running, it will automatically end when you press the stop button.

    I hope this helps.

    A

  • How to use the structures of the event for long-running tasks

    I created a state machine that scans a cluster of Boolean controls in a State of 'home '. Most of the States run a Subvi or two in ~ 100 ms or less.

    However, a State run for 10 seconds.

    The code works but the user interface is limited because the controls are outside the cluster because they provide inputs to the structure of State machine case but do not cause changes in the State. In other words, I all orders cluster stacked vertically on one side of the main panel and do not have the flexibility to move the controls to the more intuitive positions on the Panel.

    My question: How can I convert this code in a structure of the event and keep this long term 'event' and prevent that the operator by clicking another button event during the execution of this event?

    Thank you

    You say you have controls outside of your main code... You should really put these inside and manipulate them in a State of your state machine is initialized. This allows you to make changes to the code easier and limits of line entering your outside loop.

    You can do different things to lock the user.

    You can disable specific controls so that they can't be clicked or edited.

    You can use the palette of the mouse to define the busy cursor and disabled again once finished, I do this a lot during treatment when my code something loads the user just clicked.

    One of my favorites is to set a Boolean value in your data that passes through you event titled structure "disable mouse." When the value is True, a mouse down event will effectively reject the event, clicking on disable. I also added an event mouse move where if the bool disable the mouse is set to True, it moves an indicator of string with the mouse by telling the user why it is disabled.

    If you want more specific suggestions, I suggest to post an excerpt of your code, or attach your screws, so that we can better help you.

  • How to import in the video editor of first elements 13 clips with the tag structure or the person, location and the structure of the event organizer?

    How to import in the video editor of first elements 13 clips with the tag structure or the person, location and the structure of the event organizer?

    senior50

    On what computer operating system is your first items 13 running? And you have updated 13 to 13.1 still using Help Menu/implementation of an open project? If this isn't the case, please consider this.

    Now to your question immediately.

    I would consider placing your files for organizing items (person, place or event) in albums that you create in the organizer of items for each. Then,

    (a) the content of the album of the opening of the first elements add multimedia/Organizer.

    or

    (b) by selecting your album in the elements Organizer, select the photos in the album you want, then right click anywhere in a selection and Edit with Premiere elements editor selection?

    Have you been there and done that yet?

    Please examine, consider, give more details, and we can then decide what.

    Thank you.

    RTA

  • How to control the structure of the event

    What I'm trying to do, it's when the condtion is true, I want that the structure of the event to excute. But the event structure wil excute not except if he's changed the puch model, any idea how?

    It is more likely that he wants the sequence of events that he has set up to run after the result once changes.  If you change the logic to check the values after each numeric change (2), you will need to learn how to check to make sure that the latest iteration was not true.  Otherwise, it will start the sequence over and over.

    Really, you have to escape completely the structure of the event.  This isn't what you want.  Your code lends itself to a great state machine.

    You'll want to ask you a few things:

    (1) I want my code to run continuously or I just want to check double-digit times? (your code is currently the second)

    (2) I want the user to be able to stop my code once the sequence begins? (it is usually a Yes)

    (3) what I want 6 Road, path 5 or the comparison to happen first?  I want all run at the same time?  Do I need one before the other? (currently, you cannot predict what will happen first).

    You will need to understand the topics are: State of the machines, the flow of data, structures, business, calendar, and race conditions.  Now, you need to get you into trouble.

  • How to manage the structure of the event with two loops

    I have a question about the structure of the user event with 2 buttons?

    key 1: START LOGGING DATA

    key 2: STOP LOGGING DATA

    How do I control my

    structure of the event so that it will work? because now that the loop is save data... I can't stop the loop, when I clicked on buttons.

    super_saiyans wrote:

    the problem with moving it is that I don't have control of the DATA RECORD STARTING?

    Of course, you do.  When you get your press conference button, you say your state machine to move to the State of logging.  You must also make sure that you return to visit the State to wait for the event to check out the events of the stop button.

  • a few seconds "turn on", how can make I make in the structure of the event

    Hi, friends of LabVIEW

    I want to leave user click and hold down a button for a few seconds to turn on a device. Using registry item and history of shift I can make it work. I wonder how to implement it with case and structured event. Which case should I choose? mouse up?

    I have attached the test code as well.

    Thank you.

    I'm sure there are a lot of possible solutions, but here's a way to do it with a structure of the event. Mechanical action of the button is "Switch release." Pressing the button disables the output and sets the timeout of the event at certain time structure. The timeout event switches the output to true. Any other event resets the timeout to-1 value. Unfortunately, it seems that the tool gets messed up the image, so the VI is thus established.

  • How to stop a while loop structure in the event of a main vi

    Hello;

    Sorry for my English

    I have to stop to a Subvi my main VI, the Subvi contains a while loop and an event structure, so I need to stop this loop while I tried directly from my main vi, global variable, but it did not work

    any help please or example!

    How about something like this (solution see attachment) using a user event.

    Explore the User Interface--> range of events and dialogue. To display the dynamic event of the terminals in the structure of the event just right click and select 'display the dynamic event posts '.

  • How can I set up a structure of the event that sends text when the user presses the button "Return"?

    I'm new to programming of the Structure of the event.  I am trying a program which causes the content of a control to the string to be processed when the user presses the button back in after typing in the control of the chain.  I think (I hope!) that it is simple, I just can't understand how do.

    Basically, I would take the attached VI and change so that the user can send the value of control 'String In' to the indicator "String Out" either by pressing the 'Return' key or press the button 'send string. '

    Any help would be greatly appreciated.

    This example has nothing to do with the RETURN key specifically.  It fires all simply whenever the value of the control is changed.  If you click outside the text box or on another still controls the value changes and still the event is raised.  This is often the desired so if it works in your application, you good to go.

    You CAN ONLY answer a particular key if you wish.  Set your event to meet 'This VI' > key down.  Then, read the proposal Vcle on the left side of the structure of the event and compare it to the RETURN (for example).  The Boolean result of the comparison gets connected to a structure to deal with your code to run inside.  You can also wire Vcle directly to a case structure and execute different code based on which key was pressed last.

  • How to trigger the value change in the structure of the event

    HII everyone, like the title, how should I trigger the value change event to display a message... Here is my connection... I want to trigger structure of the event to bring up the subvi, when the flame and the led are TRUE State... I have using the node property, but still not able to run event structure... How should I connect? Thank you very much...

    There are several ways you can do. First of all, you need to configure your sub - vi while he does everything you want when you run (in the properties of vi, top most window for example) and to make sure that it closes completely when you're done (when you click on the 'OK' button, for example).

    Spend you need an asynchronous call to the subvi. There are several ways to do so. My favorite one below. You go in the palette under 'Application control' and select a static reference VI. I like this approach because it keeps track of the way subvi for you, as long as the subvi is in the same project. Then, drag the sub - vi on the empty square which will be changes to your sub - vi icon. Then, you connect to an invoke node in the same palette under and select run VI. "Wait, that 's" set to false and the main VI will continue to function after the start of the vi of Sub. Together "Auto Ref" is the best way to go. Otherwise, you will need to follow the sub - vi reference and shut up yourself when you are finished.

  • Control of the event: how to stop the race while loop within a structure of the event

    Hello

    I have some problems with control of a while loop inside a structure of the event (see annex VI).

    I have 3 buttons (the "Start measurement, stop, exit the program"). When a measure is running, it should be possible to stop the measure by clicking on "Stop the measure", but it does not work.

    Someone at - it an idea?

    Thank you very much and best regards,

    Michael

    Hi Michael,

    create a process parallel to your measurement. You can use the design model "producer/consumer with vents. You'll find it with «File-> new...» ».

    Another possibility would be to remove the "lock frontpanel" sign, in the case of event start measurement.

    Mike

  • How to control a VI (with a while loop and a structure of the event) from an another VI

    Hello

    I have the main VI which I want to be driven from an another VI. But I can't do that and I don't know what is happening.

    For example: VI main, I have a while loop with a structure of the event, there is a Boolean controller controlling a Boolean LED, which is inside the structure of the event. And the other VI, there is just a Boolean controller and functions of applications to open the main VI.

    How can I control the Boolean LED in VI main, changing the State of the Boolean controller in an another VI?

    Thank you.

    There are different options, but depending on what you want to do. For this example I can't give you a specific solution.

    I do not understand why you do what you do. Why do you call your 'principle VI' dynamically? What is the advantage to do? There are also other ways to call a VI dynamically, based on real cases (for example the method "call and forget", etc...).

    In you principle VI, control you Boolean ("THATCHER") is not the case of corresponding event. This is not usually a good practice, keep it inside.

    Also, why you try to communicate with the caller and callee VI through such a way to twist? There are better ways to do it.

    In one of my projects, I use the user event to launch orders in case of case of appellant VI.

    some Associates more readings for you:

    http://www.notatamelion.com/2015/03/23/how-to-make-dynamic-subvis/

    http://forums.NI.com/T5/LabVIEW/Dr-Damien-s-development-event-structures-III-communicating-with/m-p/...

  • How do I step manually in code that uses a structure of the event, when I want to select a particular event?

    I use an architecture of producer/consumer for an application with a structure of the event in the upper loop. Events are triggered by the user from the control panel using Boolean switches that are "change when you press on" and "release switch. My question is how can I manually step through the code using various events? It doesn't matter what I'm still not in the same event.

    Thank you.

    You can view the code? Is what event still enter? I did have problems step by step in code that uses a structure of the event. You must be patient, but because the application is slowed down a bit and it can take a while to get into the case of the specific event depending on what events you deal. Usually, I place a breakpoint in the case I am interested and run the application as usual. Once I hit the breakpoint is when I turn on highlighting of execution.

  • How can I use the same graph of façade in several events in a structure of the event?

    I want to display my sensorDAQ signals in a graph.but I have more than one event in the case where the structure to acquire the signal and display it in the first round of graph.the is to acquire signals from threshold and its shown in the graphic as a feedback.after the first event is executed, I'll call the second event, where the other signals are acuired and compared with signals from threshold of event 1 my question is how can I use the same control on front panel in more than two events in the structure of the event? Please answer me I am stuck.

    Hello

    I have attached here an example of doing the same thing using local variables and shift registers. Take a peek inside. Shift register is always a better option than local variables.

    Kind regards

    Amine31

    (Bravo to give good answers, mark it as a solution if your problem is resolved)

Maybe you are looking for