While loop doesn't stop until 2 more clicks

I have to say I am really not familiar with LV at all, but Im learning.
So, why is that after I clicked stop bottom, I had to click my OK button twice, then my program stopped. Why it can't stop immediately?
Besides, if I want to some the dice result by array, which wire am I missing?
Thank you!
Solved!
Go to Solution.
Attachments:
dice.vi ‏15 KB

Hi RawtoLV,
You have a while loop within a while loop. When you run the other while loop stops when you pressed the stop button, the inner while loop still runs. Since your OK button is using Latch when released, what i noticed is that when you pressed that OK button, it quickly switched to from true to false which didn't stop that while loop operation (could be due to the wait). May I ask what are you actually doing with the sequence structure?
I would suggest using event structure instead (http://zone.ni.com/reference/en-XX/help/371361K-01/glang/event_structure/):
here some more info on event structure:
http://www.ni.com/white-paper/3331/en/
http://www.youtube.com/watch?v=8eO64fo3Pho
Warmest regards,
Lennard.C
Learning new things everyday...

Similar Messages

  • I unplug my MacBook Pro from power and external speaker and I hear incremental beeps and sounds as if email being sent. Doesn't' stop until I close email

    I unplug my MacBook Pro from power and external speaker and I hear  incremental beeps and sounds as if email being sent. Doesn't' stop until I close email.   Not sure what is happening our what if any emails are being sent.

    You can install Temperature Monitor and have a look if the CPU oder GPU oder something else went to hot. The processor has a built in safety mechanism to shut down the computer before taking damage.

  • Do while loop doesn't end

    my do while loop does not exits can help?
    do{
                   a++;
                   System.out.print("Enter account number "+a+" (Press ENTER to exit) : ");
                   account=CspInput.readString();
                   item[a-1] = account;
                   System.out.print("Enter credit card expenses for "+account+" : $");
                   price=CspInput.readDouble();
                   amount[a-1]= price;
                   System.out.println("");
                   if((a-1)==0)
                        summaryByMonth[i-1]=item[a-1]+"\t\t"+fmt.format(amount[a-1])+"\n";
                   else
                        summaryByMonth[i-1]+=item[a-1]+"\t\t"+fmt.format(amount[a-1])+"\n";
                   totalAmount[i-1]+=amount[a-1];
              }while(account != null && account != " ");

    si0ngch33 wrote:
    my do while loop does not exits can help?
    do{
                   a++;
                   System.out.print("Enter account number "+a+" (Press ENTER to exit) : ");
                   account=CspInput.readString();
                   item[a-1] = account;
                   System.out.print("Enter credit card expenses for "+account+" : $");
                   price=CspInput.readDouble();
                   amount[a-1]= price;
                   System.out.println("");
                   if((a-1)==0)
                        summaryByMonth[i-1]=item[a-1]+"\t\t"+fmt.format(amount[a-1])+"\n";
                   else
                        summaryByMonth[i-1]+=item[a-1]+"\t\t"+fmt.format(amount[a-1])+"\n";
                   totalAmount[i-1]+=amount[a-1];
              }while(account != null && account != " ");Either use a debugger or put some print statements in the loop to see what the actual value of account is:
    Example:
    do{
        //... bunch of code
        System.out.println("DEBUGGING - account is '"+account+"'");
    }while(account != null && !account.equals(" "));

  • Why the Safari download icon doesn't refresh until you single click on it

    After Leopard I found that when I download files in the stack, the icon doesn't reflect the downloading status like it used to in leopard. I mean the progress bar on the icon doesn't move until it finishes download or when you click on it. I tried to download on the desktop, the same thing happens
    Another problem is I can not eject disk image nor computer on the network. Though external HD and optical disk eject w/ no problem.
    Message was edited by: Michaelfengdayu

    And this problem seems to be systemwide. Since I created a new user and under which problem still exists.
    Hope apple will look into it

  • For loop doesn't stop at any point

    public function getLabel(jail):String
           var frameLabel:String = mc.currentLabel;
          for(var i=0; i<jail.currentLabels.length; i++)
                 if(jail.currentLabel == jail.currentLabels[i].name)
                       trace(jail.currentLabels[i].name);
                     if(mc.currentLabels[i] != undefined)
                             frameLabel = mc.currentLabels[i+1].name;
                      else
                            frameLabel = mc.currentLabel;
           return frameLabel;

    if you want to stop the loop if you get a match, use:
    public function getLabel(jail):String
           var frameLabel:String = mc.currentLabel;
          for(var i=0; i<jail.currentLabels.length; i++)
                 if(jail.currentLabel == jail.currentLabels[i].name)
                       trace(jail.currentLabels[i].name);
                     if(mc.currentLabels[i] != undefined)
                             frameLabel = mc.currentLabels[i+1].name;
                      else
                            frameLabel = mc.currentLabel;
           return frameLabel;
           return frameLabel;

  • My nano (4G) shuts off while playing, doesn´t respond until plugged in, then apple logo appears and it restarts.  Restore worked for a week, same problem today.  Says it is 50% charged.

    My Nano shuts off in the middle of playing music/podcasts. It won´ respond until plugged in, then apple logo appears and it restarts.  I restored factory settings and installed the newest OS which worked for a week, but it´s the same problem today.  It happens while at 50% power or better (according to battery icon).

    It sounds like the battery itself is going bad, which is likely given the age of the 4G Nanos.  You'll want to have your iPod serviced by Apple or a third party service center to have them swap the battery out.  Otherwise, it's time to start investing in a new iPod.
    B-rock

  • I have a VI with a while loop controlled by "stop" button. How can I finish the running of this VI in a another VI programmablly.

    I mean I want to control the "start" and "stop"
    of a VI with another VI.
    Thanks

    1... Change your slave VI to stop on the button OR a global boolean variable.
    2... When your slave VI does stop, set the global variable to FALSE (ready for next time).
    3... Set the global to TRUE from the master controlling VI, on button click, or whatever is supposed to stop the slave.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • HT201401 hello there . i was use my iphone and its was working and i found it stuck and after while is turn off .stop working any more .its won`t turn on or connect to computer or charge ... i don`t know what is going on ?

    plz someeone help my iphone stuck then turn off and won`t turn on any more or connect to computer or charge any more????and today i found it working for 1 hour and turn off again plz help

    Who repaired the phone? I suggest taking it back to this repair facility. Since Apple replaces phones instead of repair, the repair facility would be the one to take care of your problem.

  • 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

  • How to stop while loop

    I can't figure out how to stop a while loop in my labview program. 
    When the user presses the Run arrow in the toolbar I want my program to begin reading the serial port for GPS messages.  These messages should be displayed on the front panel.  Currently I have this read/display in a while loop.  The program is also waiting for an extrenal trigger.  When that trigger arrives, I want to grab the current string from the serial port and save it and continue reading and displaying the serial/gps string.  This trigger starts the other parts of the program- signal generation, recording, and saving data which need to run concurrently with the serial/gps reading/displaying.  Once the AO and AI have finished and the data have been written to disk, I want the program to stop.  The serial/gps messages should be updating this whole time.  Only when the data are written to disk should the whole program end.  This whole sequence of events should only be done once when the user preses the Run arrow. 
    So far I'm unable to pluck the serial string when the trigger comes in if I'm watching the serial port all the time.  The program also doesn't stop when it finishes writing to disk because the read serial while loop is still running.  I don't want to use a front panel stop button.  The program should stop itself when the data havebeen written. 
    I'm really stumped on this one but I'm new to LabVIEW so I'm sure there's an easy solution to this. 
    Thanks for any and all help. 
    Attachments:
    SPoleLakeChirp.vi ‏199 KB

    Dennis and altenbach-  Thank you both for your patience. 
    I was trying to do just what Dennis suggested-"As I said, setting a local variable is one way." even before posting to this forum, but I couldn't get my local variables to reflect changes made elsewhere in the program and I wasn't able to wire from them because they were writes.  The critical part I was missing was how to change a local variable from a write to a read.  It was staring me in the face the whole time- just right click.  When I finally found it, my problems were solved. 
    altenbach- thank's for putting the figures together.  I do understand the logic and wiring there, but I was really trying to avoid stop buttons.  The program should be smart enough to figure out when to stop.  And using local variables turns out to be one way of solving this.  I still have some clean up to do, but I've included my current working version just so you can see how I implimented your suggestions.  There's still a lot of clean up to be done, but I'm delighted to be able to watch the serial/gps messages until I'm done reading in data.  At first I had this stop variable set in the final sequence frame.  That didn't work because I wasn't getting to the final frame because the loop wasn't finishing.  Once I placed the stop variable in the same frame as the while loop it began stopping when it should. 
    If you have other comments/critiques about the wiring diagram I'm earger to hear them.  I'm considering the structure finished, however.  It still needs cleaning up and commenting, but I'm satisfied with the functionality. 
    Thanks,
    Peter
    Attachments:
    SPoleLakeChirp.vi ‏210 KB

  • Stop dependant while loops with 1 button

    Hi,
    I am developing a utility that allows a user to configure up to 2 devices (both use same driver with a different board number), click initialize, which then brings up a file dialog and displays arrays for the data to be collected and some error messages for each measurement.  The user then clicks the Start/Stop button to begin collecting and logging data.  Currently i have a Wait(ms) block to allow the user to set often the measurement should be made.  Currently the Start/Stop button allows collection to be started, paused, and started again.  My problem is trying to have a master stop button that should stop all loops immediately when it is pressed.
    I tried using a global variable for the stop button, but the measurement and logging while loop doesnt stop until after the wait(ms) block times out.  Can anyone give suggestions.  If i need to restructure the VI into different loops, I can do that.  I just want to understand the right way to program something like this.
    The VIs are attached.  I removed the device specific measurement VI so that anyone can open the vis and run them to see how it works.
    Attachments:
    2Devices_withoutMeasurementVI.vi ‏112 KB
    BuildOutput.vi ‏27 KB
    stopGlobal.vi ‏5 KB

    Ok.  I had a chance to take a look at your code and I think you don't quite understand the concept of "dataflow".  Let me see if I can help.
    First of all...when I refer to your upper structure, I am referring to the first while loop, sequence structure, and subsequent while loops.  When I refer to your lower structure, I am referring to the while loop containing the event structure.  Just so we get our terminology straight.
    I believe that you are under the illusion that your upper structure contains three parallel while loops.  It does not.  It contains three SERIAL while loops.  There is dataflow dependency between the while loops.  The sequence structure requires data that is not available until the first while loop has finished executing, so the sequence structure cannot start executing until the first while loop has terminated.
    The second while loop requires inputs from the first frame of the sequence structure (which, by the way, you don't need and should get rid of...the sequence structure, I mean), so it cannot start executing until the first frame of the sequence structure has terminated.  The third while loop requires inputs from the second while loop...so, again, the third while loop cannot run until the second while loop has finished executing.
    Now, for your stop button.  You have that global stopping all three loops.  So here's what is happening in your program:
    Your program starts.  The first while loop executes in parallel with the loop which contains the event structure.
    At some point you press the "stop" button.  Both the first while loop and the loop containing the event structure finish executing.
    The first frame of your sequence structure executes.
    The second frame of your sequence structure executes.  The second while loop reads the "stop" value from the global, so it executes once and then finishes.
    The third while loop starts executing.  Again, the loop reads the "stop" value from the global, so it executes once and then finishes.
    Then your program terminates.
    You need to restructure your program, because right now it doesn't make any sense at all.  Your block diagram would benefit from some serious tidying up as well, your wiring is a mess.  I suggest you look into a state machine architecture for this program.

  • Stop While loop

    Hi
    I have a while loop with a cycle time of 100 sec, when I stop it I have to wait 100 sec untill the while loop stops.
    There is any manner to stop it immediatly?
    Thanks

    Why are you using a property node for a control that is not accessed within the loop?  And the conditional terminal is set to run if True. 
    Your while loop doesn't make sense.. Can you post the entire code (attach your vi) and explain what you are trying to do?
    R

  • How do I create a start/stop button for each separate while loop within my program, when each of them does a different task?

    I have a multimeter VI with separate while loops to accomplish the different tasks of reading  voltage, current, etc. Each while loop has a stop button, but I need a button that will have to be pressed in order for the while loop to even start. I tried putting another while loop around the present one, but it still has to run once before it will stop. I want the user to have to press the button before it runs, because they interfere with each other.
    I am just learning so patience and your kind assistance is greatly appreciated!
    ElectroKate

    iZACHdx wrote:
    Hello,
    I'm not entirely clear with everything you have going on and what you want your final functionality to be, but you can use sequence structures to prevent a loop from starting until the user presses a button like this:
    -Zach
    I have to ask, why is an NI employee using examples using sequence frames? The same thing could be accomplished using data flow by simply wiring the value of the first stop button out of teh first while loop and connecting it to the second loop. This would then use data flow to control the sequence. Why show new users bad programming methods?
    As to the original question I would concur with altenbach on using an event structure.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How this while loop is stopped

    The attached VI is an LabView example VI and I did a little modification. If I want to stop this VI, I will have to click the Wait loop stop button then click Set Occurrence button twice, finally click the Set loop stop button to stop the program. My question is, if we click the Wait loop stop button and click Set Occurrence button once, the conditional terminal sees the True signal, it's supposed to stop, but it doesn't stop until we click the Set Occurrence button again then click the Set loop stop button. We can see it from the Wait and Wait 2 LEDs. Any one can give some explanation? Thanks.
    Guangde
    Attachments:
    Generate Occurrence2.vi ‏23 KB

    Thank you for responding to my question.  I think I understand it now. The first click of the Set Occurrence button, the lower loop gets out of the current iteration. At next iteration, even though the conditional terminal sees the True signal, it can not exit because it's waiting for the loop to finish. Only after we send the Occurrence again then the loop will finish it's task and exit. Again, thank you for your help.
    Guangde

  • How to stop while loop for particular time

                    public void test()
                   new Thread(new Runnable()
                        public void run()
                             //Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
                             System.out.println("test");
                             //System.out.println("test ..."+i);
                             try
                                  Thread.sleep(3000);
                             catch (InterruptedException e)
                   }).start();
            public void startTest()
                    while(i < marquee_Str1.length)
                   marLbl1.setValue(marquee_Str1); //set value to textbox for perticular id
                   marLbl2.setValue(marquee_Str2[i]);
                   marLbl3.setValue(marquee_Str3[i]);
                   test(); // call thread function
                   i++;
    in this code while loop don't stop
    plz help me to stop while loop for certain period by using thread or other technique                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Yes.. the original problem would be your test() method put the sleep in an entirely separate thread of execution. So the thread is created then the method just keeps waiting. The while loop should directly call Thread.sleep... which you have apparently figured out!

Maybe you are looking for

  • Keys Out of Order - Startup Problems HELP!

    Hi I have an iMac G5 running OS10.4.5. It has the following problem: - Wont boot up off internal HD - I get flashing ? alternating with smily mac on folder icon I tried booting up on instal CD and running disk repair, get message "keys out of order"

  • Pros and Cons of Clustering switches

    Can someone tell me the pros and cons of clustering switches? It sound like its just for managing multiple switches or is it more trouble that its worth? TIA

  • Home button wont work

    My home button stopped working.. I was wondering if there was anything I can do to make it work again? I basically have to turn my phone off and on to get to a certain page..

  • Bootstarp 2  nav menu in bc(3rd level drop downs)

    Hi everyone, I am making a module V2 bootstrap nav menu in BC but i cant get the 3rd level  ITEM_1_1  and Items Item2_1_ and item  ItEM2_1_1 to open, Here's the code of the file children.html for  this. <li class="dropdown"{tag_menuitemidname_withid}

  • Change in Delivery adress

    Hi Experts, I have a issue related to the delivery address change .I have the address no and i can see it in table ADRC .but when I am trying to change by t-code MEAN to it is showing as adress doesn't exits Can anyone suggest me how to solve this is