Event controll: How to stop a running while loop inside a event structure

Hello,
I have some problems with controlling a while loop inside a event structure (see attached VI).
I habe 3 buttons ("Start Measurement, Stop Measurement, Quit Program"). When a measurement is running, it should be possible to stop the measurement by clicking on "Stop Measurement", but this does not work.
Has anyone an idea?
Thanks a lot and best regards,
Michael
Message Edited by MichaGue_01 on 04-23-2010 04:37 AM
Solved!
Go to Solution.
Attachments:
Event_Controll.vi ‏27 KB

Hello,
Try not to use while loops inside a Event structure.
My approach is using two While loops (one will have only the Event structure).
I had to use to Flag buttons that make it a bit more complicated but i am sure somebody will come up with a better idea, or you might want to have a think about it yourself.
Have a look on the modified version on the attachment.
Once you are happy how it works then you can Hide the 2 flag buttons from the Front Pannel by going to Block diagram right-click the indicators and choose option "Hide Indicators/Controls"
I did it in LV 8.6 so i hope you can open it on your PC if not i can downgrade it.
If you have any problem let us know.
Regards
Dimitrios
Test Systems Computing Engineer
Cummins Turbo-Technologies
Attachments:
Event_Controll[1]_modified.vi ‏18 KB

Similar Messages

  • How to stop execution in while loop without stopping execution of other loops in the same vi

    HI
    I am quite a novice in Labview.
    I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
    Can anyone help me?
    Rahul

    Hi Rahul,
    Modified ur Vi to work with single button.
    But the subtract case is not in any loop.
    So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
    so think of a logic where u can put this also in a new loop.
    Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
    Let us know how you will proceed in this regard
    I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
    Plus, always keep a time delay in your while loops.
    Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi
    Regards
    Dev
    Message Edited by devchander on 01-10-2006 06:15 AM
    Message Edited by devchander on 01-10-2006 06:19 AM
    Attachments:
    arrayinouttestnewfinalnew4.vi ‏59 KB
    arrayinouttestnewfinal.vi ‏63 KB

  • Exit a while loop inside an event case

    Hi All, I have a multi-page program. One of it is used to read some analog signal via a USB block continuously.
    What I want is when clicking this page, this while loop is activated. Then we can monitor the data. When we click other pages or "Stop" button, this while loop will be terminated. And we can use the other pages to do something else.
    Right now I got difficuties in stop the while loop. I do not want to stop the running of the whole program, just want to jump out of this while loop then do other operation.
    Could anyone give me some advise how to do it? Thank you very much! 

    Hi RavensFan, thank you for your reply.Actually this is not my real code  because the original one is very very compliacted.
    In real code, the tab control you see in inside the bigger while loop, that loop makes the whole program work.
    And as what I pointed, the purpose is when I click this tab (if we do not want it to trigger, we can place another "START" button to trigger), an internal while loop inside begins to run. This while loop keeps showing the real time analog signal.
    And if I do not want to use this "real time monitoring" function, I want to click somewhere (or doing anything else that can work) to jump out of this internal while loop and keep on using some other functions of the program.
    Could you advise about that? Thank you very much! 

  • While loop inside a event structure

    Dear
    I have no much concepts on event structure.
    Let's assume there is a dialog box with Okay and Cancel button.
    I put the event structure for Okay and Cancel button.
    In Okay event, there is a while loop for detecting some data continuously.
    In this case, I want to use Cancel button to stop the while loop during the detection.
    How can I do to receive signal from the Cancel button?
    Thank you in advance.

    I'm not sure that the event structure should be used to handle that situation : while the OK event is executing, either the Front panel is locked and new occuring event will be stored until the OK event is completed (so the Cancel button action will not be detected !) or the Front panel is unlocked (see below *) and the Cancel button action will stop the loop, but the Cancel button event case will not be executed, since the event has already been processed in the OK case !
    You should probably use a single button to run/stop the loop, as shown in the attachment
    * While editing the event case, unmark the "Lock front panel for this event complete" at the bottom. But of course, the code in the cancel case will not run, since the event occuredMessage Edité par chilly charly le 03-31-2007 05:27 PM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Event button.vi ‏11 KB

  • How to stop a second while loop when the condition in the first one is met for different VIs

    Hi, am running two seperate Vi's. am new to labview so please help accordingly.
    I have introduced a comparison test  in one Vi through ashift register. i would like now the second Vi to stop when this comparison condition in the first Vi is met. 
    I dont want the first Vi to stop, it should only stop the second Vi while awaiting for the next input.
    waiting for your help guys

    Thanks so much guys. am now starting to pick some ideas. i have attached the Vis as requested for best identification of the help.
    waiting help guys
    best regards
    Alex
    Attachments:
    first Vi.vi ‏132 KB
    second vi.vi ‏149 KB

  • How do i exit a while loop using event handler

    Hello,
    I have an event handler structure within which i run a while loop for a particular event. I would like to interrupt the execution of this while loop as soon as another event occurs, even if the while loop has not finished execution. I have tried so many ways, the best i could get is exiting one itteration after the new event occurs which is no good for me.
    Any suggestions???
    Thanks
    Me

    Instead of having a task while loop in an event case, put your task while loop in parallel with the loop surrounding the event structure. When the event which should start the task occurs, you can signal the start of the task while loop. You could use local variables of references to start/stop the loop when an event occurs. You could also use notifiers instead of variables to pass signals to start/stop the while loop. In general you should have a while loop for the event structure, and a parallel while loop to do the tasks. The parallel loop is controlled by variables or notifiers which are set in the event cases.
    - tbob
    Inventor of the WORM Global

  • How to 'STOP' a running java thread in J2ME?

    Dear All,
    How to 'STOP' a running java thread in J2ME?
    In the middleware viewpoint, for some reasons we have to stopped/destroyed the running threads (we have no information how these applications designed).
    But in J2ME, Thread.destroy() is not implemented. Are there other approaches to solve this problem?
    Thanks in advance!
    Jason

    Hi jason,
    Actually there are no methods like stop() and interrupt() to stop the threads in J2ME which is present in normally J2SE Environment.
    But the interrupt method is introduced in Version 1.1 of the CLDC.
    So, we can handle the thread in two ways.
    a) If it is of single thread, then we can use a boolean variable in the run method to hadle it. so when the particular boolean value is changed , it will come out of the thread.
    for eg:
    public class exampleThread implements Runnable
    public boolean exit = false;
    public void run()
    while(!exit)
    #perform task(coding whatever u needed)
    public void exit()
    exit = true;
    b) If it is of many threads then we can handle using the instance of the current thread using currentThread() method
    for eg:
    public class exampleThread implements Runnable
    public Thread latest = null;
    public Thread restart()
    latest = new Thread(this);
    latest.start();
    public void run()
    Thread thisThread = Thread.currentThread();
    while( latest == thisThread )
    #perform some tasks(coding part);
    public voi d stopAll()
    latest = null;
    while ( latest == thisThread )
    performOperation1();
    if( latest != thisThread )
    break;
    performOperation2();
    Regards,
    Prathesh Santh.

  • How to stop the running infospoke

    Hi Experts,
    there is a infospoke is still running so long time, it's incorrect, i'll cancel it as kick off the dependenies, i have no idea to how to stop the running infospoke. Anybody could tell me how to do it. thanks in advance.

    hi denny,
       Go to SM37 , find the job , stop the process
    or
       To stop the job find the job with the help of the request name ( TC - SM37 ),then in the job Details find the PID .
    find the process in the process Overview (SM50 / SM51 ).
    Set the restart to NO and Cancel the process without core
    u can also see these threads that are already posted:
    stopping v3 run job LIS-BW-VB_APPLICATION_02_010
    how to cancel or change the background job which is scheduled
      In SM37, for the job , click on Step button. Then from the menu Goto > variant. You can see the process chain name here.
    sure it helps
    Thanks
    Varun CN

  • How to stop the running process chain

    How to stop the running process chains or infopackges...just qm status change is enought?

    BI - SM 37 - Kill the Job
    ECC - SM 50 - Kill the job

  • Run for loop inside event node

    Hi all, 
              We want to run for loop inside event node with 50ms delay. But when i am doing it the Labview is crashing. Please let me know if somebody did this.
    Thanks in advance,
    Regards,
    Harish. G
    Thanks & Regards,
    Harish. G.

    harishg92 wrote:
    Hi all, 
              We want to run for loop inside event node with 50ms delay. But when i am doing it the Labview is crashing. Please let me know if somebody did this.
    Thanks in advance,
    Regards,
    Harish. G
    You're implementing a For loop inside an event structure? (I don't know of any event "node" in which you can run a For loop)
    If so, that's a bad idea because LabVIEW won't be able to process any events while waiting for your For loop to get done, which might be why its crashing.
    There are tricks to accomplishing what you're trying to do without putting any for loops inside event structure. See what I have  attached and if it helps. "N" is number of times you run your For loop, timeout is whatever delay you want in each loop. This can be done in many ways without adding delays in events, another way could be to fire a separate subVI using Asynchronous call (without waiting for the VI to finish) during those delays, just make sure that such subVI finishes processing within your allocated time (that's how I'd ideally implement things). That method is better because you're doing minimal work inside events structure while using wait period wisely in a separate/parallel process.
    I hope that I understood you correctly and did not go off on a tangent.
    -BTC
    New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI
    Attachments:
    ForLoop inside Event Structure.vi ‏11 KB

  • Stop execution of a loop in an event structure

    I tried searching the forums to avoid posting a duplicate, but most I could not open most of the vi's as they were higher version.
    I put in a dummy while loop in an event structire i intend to use. Once I start executing the while loop, I am not able to stop it using a control for some reason from the fornt panel control.
    I am not able to change the vale of the Stop control at all. I tried creating a seperate event for STOP, and I still could not stop the program when the While loop was executing.
    I imagine I am missing something really small. I would appreciate your feedback on this.
    Thanks,
    Nevil
    Solved!
    Go to Solution.
    Attachments:
    FrontPanel.vi ‏34 KB

    Right click on the event structure and choose "Edit Events" for the case that is giving you trouble.
    Be sure the checkbox to lock the front panel is unchecked.
    I suspect yours is checked, so your front panel is locked out until the event completes, thus you can never stop your loop.

  • Stopping a while loop inside a while loop

    Hello,
    I have a while loop which is inside a while loop which houses my enetire application, When stopping the inner while loop portions of my outer loop stop working, How do I setup the inner while stop that it will not interfeer with the outer while loop?
    Thanks,
    Gil,

    It sounds like he is using a simple archetecture.  But switching to a different archetecture may not be necessary.  Simply because it doesn't work, doesn't mean scrap the whole thing and start over.  He's got a bug and needs to fix it.  Is it the best archetecture to use, absolutely not, but simple or general archetectures can be effective based on the application.
    Post your VI so we can take a look and give you some pointers and suggestions for improvement.
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home

  • How to out from infinite while loop in sub VI

    Dear Sir,
    how to out from infinite while loop in sub VI from main VI
    attached photo for solution but I can't understand it and i can't find the function in photo 
    please help
    Attachments:
    stop_subVI_frm_main.JPG ‏36 KB

    Asking how to get out of an infinite loop is like asking how to find the end of a circle. I'm not trying to be sarcastic but by definition, if there is a way out of the loop, then it is not infinite. I think what you are asking is how to avoid creating an infinite loop. Is there something about the suggestions you have been given that you do not like? My favorite suggestion is the notifier but maybe you just need an example. Turn on context help and read about the notifier functions in the code below.
    This is your top level VI
    And this is your subVI
    If this seems too complex then a global variable will work too. But what seems simpler can cause much more complex bugs. You can code fast and spend lots of time debugging or you can code slow and spend less time debugging. Personally I perfer writing productive code than looking for bugs any time.
    =====================
    LabVIEW 2012

  • I just uploaded lots of pictures.  They are only showing under last import but not in events.  how do I get them to show up under events?

    I just uploaded lots of pictures.  They are only showing under last import but not in events.  how do I get them to show up under events?

    Read this: http://help.apple.com/iphoto/#pht211dc8fc

  • Ending a while loop inside a while loop

    How do I make a while loop run as long as the while loop that contains it is running? I tried wiring both conditional terminals to a stop button in the outer loop, but that doesnt seem to work? Is there another way?
    Thanks.

    Hi Jasonalan,
    I am not sure what you are trying to implement, but it is true that the loops are not terminating because of data dependency. The stop button in the outer loop will not be read until the inner loop terminates.
    If you wish to terminate the two nested loops using a single stop button, you should read the stop button inside the inner loop and wire it to the conditional terminals in both the inner and outer loop. Again, there is no point in doing this unless you have some other logic along with the stop button to stop the loops. If only the stop button is being used to stop both the inner and outer loops, the outer loop will only execute once. In that case, you can just use a sequence structure followed by a single while loop.

Maybe you are looking for

  • Oracle Licencing in Solaris Zones

    Scenario If we setup a server with 6 processors and we setup 1 resource pool with 4 processors called oracle_pool. We then create 2 Oracle Containers both using the same resource pool, ie "oracle_pool", will I require 4, 6 or 8 Oracle Processor Licen

  • Traffic light in collective delivering processing

    Hi Folks, I was wondering while doing collective delivery processing against STO..i am able to process delivery inspite of red traffic light when it should be only under yellow light ...How is that possible ? also would like to know how and when red

  • Updated Illustrator smart object in Photoshop views blurry

    Hi all, This is probably an insultingly simple query but: I've created a map in Illustrator, opened this as a smart object in Photoshop and dragged it in as layer in a PSD. When needing to make changes to the map, I've double clicked the smart object

  • RMAN and init.ora

    What are init.ora parameters that controls behavior of RMAN in Oracle 10g r2. Thanks, R

  • Update loop

    I had a couple apps that were updating. My wifi was shut off, and stopped in the middle of the update. Now whenever I am connected to wifi, I get the little spinning wheel at the top left corner that signifies its updating but nothing happens. I've t