stop the loop inside while loop

Hi all

Is there a way to stop a loop within a while loop? Error-free program will stop running when you press the stop button, but I want to while loop continues to run in and only for the loop stops when the condition is met.

Thank you!

Hi TayAus 1.

If you want to run the execution once? Maybe something like below? The code inside the structure of events can only run when the event source is triggered. For example, the code in the digital works only when it detects a change in the numerical value (just an example).

When the button is selected, it should raise the event to stop as shown below:

If you want to create the event source, create the structure of the event > right-click on the frame and select edit events dealing with this... > This should open Edit events.

The example below is that I put the event source for the change in the value of x and x 2.

So when x or x 2 value is changed, executes the code in the sous-schema event shown below.

Warm greetings,

Lennard.C

Tags: NI Software

Similar Questions

  • Stop the loop in the process

    Hello

    Once, I am for another question, desire to learn more about labview and these countless obscure secrets.

    Well my problem seem is a common problem, but I have not found the answer in other topics.
    Here are the levels of my (simpler if you look directly at VI) VI

    1st level, I have an event to bring the action or return to the main Vi
    level 2 (during the measurement process), I have an loo whilep with an event case inside to stop the loop if the process is blocked. but it does not work.

    And to make matters worse I can't press the keys at the start of the measure

    I'm on this problem for 10 hours is not a question asked without thinking, but I am really stuck.

    Thank you

    Firstly, stacking of the structures of the event is going to be tricky, very quickly, so I want to disencourage to do until you are an experienced developer of LV. You are currently a little diving on the "first numbers", which is generally understood as the warnings from the structure of the event.

    The second thing is that I understand that you want to terminate the wait function itself (which represents your external code). This can be done. The reason is simple: LV is just waiting for the code complete. So saying LV to stop his execution will happen as soon as LV "took over". This will happen once the external code is complete.

    You CAN complete the thread using the Windows API, but you should / must restart the entire application of the LV to prevent corruption of memory created by the son put to death (not recommended).

    hope this helps,

    Norbert

  • goes into infinity "tabs" loop when I type any email 'Contact us' button how can I stop the loop?

    goes into infinity "tabs" loop when I type any email 'Contact us' button how can I stop the loop?

    You use a Mac, or you're on another platform?

    Any other use of platforms:

    • Mac: Firefox > Preferences
    • Linux: Edit > Preferences
    • Windows: Firefox > Options

    Press F10, if the menu bar is hidden under Windows and Linux, or use "> Firefox Options/preferences.

  • lets stop the loop parralle notification

    Hello

    Everyone

    I created several loops producer/connsumer.

    A loop producer is business event that hold value control change of FP and then send queue consumer loop (solenoid)

    The other separate producer loop is to NEITHER 9213 display Temp data, I use another loop of consumer to acquire the data of NI9213

    I don't know if I can use notification to stop the two pairs of earrings.

    I hope that when I click on stop the whole process in PF button, then, the True value is sent to the notification. The NI 9213 producer loop then get this message to stop the loop. Now, stop process only control solenoid buttonhole since this button is in the structure of the event.

    I tried the notification. When I put wait notification NI 9213 looping, this loopkeep wait any notification and doesnot monitor temporary data

    Thank you


  • Structure of the event inside while loop

    I'm still fairly new to Labview and this may seem a simple question.  I'm doing a Subvi to display, edit, and create configuration files.  I use a ListBox to list all sections of a config file and structure of the event to update the values in each section, when they are clicked.  The problem is that the structure of the event seems to be a break the while loop so that the buttons do not work until the event has executed.  What I would like is the while loop to run continuously and the event to run only when I click in the listbox control.  I hope this makes sense.  There is a peak in the diagram below. Thank you

    There are a number of issues with your code that could cause problems:

    1. You must use the FP. Open method to open the front panel of a VI and of the public Service. Close method to close. I don't remember exactly the problem, but starting with the 7 worm nor indicated that these methods were the preferred way to perform these tasks.
    2. Based on what seems to be the code, the event for the control of Presets of wood should be a change the value - not a mouse down event. After changing the type of event, use the event data NewVal to drive the indexer table index entry.
    3. The buttons Ok and cancel them should be handled in their own events to change the value. The value change event Cancel would exit the loop, while passing the output error (which indicates that cancel was pressed) and default values for the other 4 outputs. The change of the value Ok event would leave the loop by passing the values that the operator had concluded the 4 controls on the front panel.
    4. An event of timeout with a very short time (1 msec) would stop loop if an error has occurred, or the output of the gate AND is set to true.
    5. The wait function is not necessary, as is the case outside the loop structure.

    Mike...

  • Stop the loops with a button

    I have an infinite loop is and display of data. How can I end the loop with a button or a keypress?

    Periodically perform a ProcessSystemEvents() call inside the loop. In a reminder of the STOP button, set a flag to indicate your loop to stop.

    stop unsigned int = 0;

    While (! stop) {}

    data getmeasured

    display the data

    ProcessSytemEvents()

    Sleep (250);   to be polite: it is impolite to spinlock, since you will monopolize the CPU and other threads can get hungry

    }

    then, in the reminder for a STOP button

    STOP the button callback routine

    stop = 1;

  • stop the loop only in certain layers

    I have successfully stopped a loop in one of my layers, but it also affects the other layers, I want it. I have a layer of moving clouds that I would continue to animate during playback.

    Is it possible to have a stop(); applies only to one (or more) layers?

    Thank you

    No, a judgment will affect a whole chronology, not only a single layer.   You must create some movieclips of the things you want to keep moving or the things that you want to stop so that you can control their schedules individual (or not).  To start, try copying your images of clouds in a movieclip and place this movieclip as the layer of clouds, which extends the length of the layer so that they are present throughout it.

  • How can I stop the looping SOUND?

    Newbie here.

    I created a movie that makes a loop at the end of the last image. I have a built-in Sountrack'u which exceeds the sum of the last frame of the movie. When initially film loops, another copy of the audio clip starts playing on top of the initial melody (MP3). How can I stop the audio clip to restart when the movie back surrounds? I want just the 1st copy of the sound at the end and STOPS when the fact... or restart... I don't want it to start on top of itself...

    Cody21,

    > How can I stop the audio clip to restart when
    > the movie back surrounds? I want just the 1st copy
    > the sound at the end and STOPS when the fact... or restart
    > .... I don't want it to start on top of itself...

    Well, the sound is positioned in frame 1, probably, no? During the
    playhead enters frame 1, the sound goes off again. There are a number
    ways to configure your sound. Two basic methods are events and streams, which
    You can see the area of synchronization of the property inspector when you select the
    the frame that contains the sound. Event means that the audio load in memory all the
    at the same time and plays; Stream means that it has locked in step with the timeline.
    Stream means it does not start on top of itself - but it also means that audio
    stop when the timeline does.

    If your audio starts an image 1, I could see Adding a quick
    action gotoAndPlay (2) in the last frame of your timeline. Who would jump
    the playhead spent Framework 1.

    David Stiller
    Adobe Community Expert
    Dev blog, http://www.quip.net/blog/
    "Luck is the residue of good design."

  • I want to stop the loop button shape 10g

    I want to stop a loop in the forms of pushbutton 10g it's like (SwingWorker() in java) (DoEvent() in .net)
    The problem in forms 10g that when you start a loop shape freezes and you are unable to broadcast any button on the form, I found the solution for this in form 6i by package d2kwutil * WIN_API_UTILITY. InterruptCheck (hButton) *.
    But in 10g I can't find a solution, Please help > > > > >


    declare
    hButton PLS_INTEGER;
    Start
    : interruptcheck.counter: = 0;
    hButton: = get_item_property('INTERRUPTCHECK.) PB_OFF', WINDOW_HANDLE);
    go_item ('interruptcheck.loopcount');
    set_item_property('INTERRUPTCHECK.) PB_OFF', ENABLED, PROPERTY_TRUE);
    set_item_property('INTERRUPTCHECK.) PB', ENABLED, PROPERTY_FALSE);
    set_application_property (CURSOR_STYLE, 'HELP');
    set_application_property (CURSOR_STYLE, 'WAIT < d2kwut60 >');
    I'm in 1.:interruptcheck.loopcount LOOP
    If WIN_API_UTILITY. InterruptCheck (hButton) then
    "exit";
    end if;
    : interruptcheck.counter: = i;
    synchronize;
    end loop;
    set_item_property('INTERRUPTCHECK.) PB_OFF', ENABLED, PROPERTY_FALSE);
    set_item_property('INTERRUPTCHECK.) PB', ENABLED, PROPERTY_TRUE);

    set_application_property (CURSOR_STYLE, 'DEFAULT');
    end;

    Published by: wael amar on May 1st, 2010 23:03

    OK, here's a unit test to work.

    The idea is taken from an article in oracle magazine (I don't have at hand, she, so I tried to restore it and "memory".) I remember the original was German doag-magazine and was written by Gerd Volberg).

    How to make the loop:

    PROCEDURE PR_DO_THE_LOOP IS
      nNumberInOneStep NUMBER:=2;
      tm               TIMER;
    BEGIN
         DEFAULT_VALUE(0, 'GLOBAL.INDEX');
      IF :GLOBAL.INDEX=0 THEN
           -- Didn't run yet, determine the max count
           :GLOBAL.MAX:=10000;
      END IF;
      LOOP
           -- Do the looping stuff
    
           -- Decrease counter
           nNumberInOneStep:=nNumberInOneStep-1;
           -- Increase globale counter
           :GLOBAL.INDEX:=:GLOBAL.INDEX+1;
           -- Exit conditions
           EXIT WHEN nNumberInOneStep=0;
           EXIT WHEN TO_NUMBER(:GLOBAL.INDEX)>=TO_NUMBER(:GLOBAL.MAX);
      END LOOP;
    
      -- reset index at end
      IF TO_NUMBER(:GLOBAL.INDEX)>=TO_NUMBER(:GLOBAL.MAX) THEN
           :GLOBAL.INDEX:=0;
      ELSE
           -- start timer for next iteration
           tm:=CREATE_TIMER('TM', 10, NO_REPEAT);
      END IF;
    END;
    

    The WHEN-TIMER-EXPIRED-trigger

    IF :GLOBAL.INTERRUPTED='Y' THEN
         MESSAGE('Interrupted at index ' || :GLOBAL.INDEX);
    ELSE
         PR_DO_THE_LOOP;
    END IF;
    

    The WHEN-button-PRESS-trigger the button stop

    :GLOBAL.INTERRUPTED:='Y';
    

    The WHEN-button-PRESS-trigger on 'start' - button

    :GLOBAL.INTERRUPTED:='N';
    PR_DO_THE_LOOP;
    
  • Stop the loop

    Hi, I created a flash file and the swf file that I placed in dreamweaver, but the guard proofreading stage. I want her to play that once how disable the loop?
    Thank you

    Put a stop(); in the last frame of the timeline of the flash animation.

  • Stop the loop of movieclip

    Hello

    I am doing a map in flash, and when you transfer a name of a company (button) the construction of this company light up.

    Which works very well. The card is a MovieClip. I did this movieclip keyframes (pages).

    In the first keyframe, I entered stop();

    That worked well, but not for long. I wanted to put a few button with URL links in diffirent Keyframes (pages).

    When I typed the code so that it worked fine on the first keyframe. When I came to the second keyframe and make another button with link.

    When I tested the continuous MovieClip to play again and again and does not listen to stop(); more.

    How can this occur and why?

    Can someone help me?

    Sorry for the bad English.

    Joep

    Do you get any error messages?  What is the code you use on the different frameworks? Your keyframes are separated by empty frames?

  • Stopping at two simultaneously while loops in a sequence

    I'm under two loops while at the same time. A while loop is used to produce a square using the acquisition of data USB of NOR-6343 wave. The another while loop contains my main code. I make sure that my square wave while loop stops after the hand while the loop is over. I used the function "To highlight the Excution" to see if my code is excuting in order and the way I expected to and it seems to do, but when I hit the button stop the square wave while loop stops so that the main while loop always ends excuation. The main while loop takes a series of measures using the data acquisition Toolbox, so I need to make sure that the square wave is being emitted during the execution of the loop of mian.

    Currently to work around this problem, I wired a constant numberic (101) inside the large loop for a numberic out indicator. And I used a cheque codition "Equal" in the square wave while loop and set it so that this loop stops when he sees the value. This seems to work and made sure my square wave still series, while the main loop is excuting finishing. Even if it works, I want to know if there is a better way. Attached are a couple of screenshot of the loops.

    I vote for using a notification utility.  You must order the loop at the end.  Do a front panel indicator to stop a loop is not a good practice.

  • How do I stop the Animation loop?

    What I'm trying to do, is make sure loading my home html-based page, the logo is lively and makes a sound. When the sound is complete, the logo should stop hosting and be static for all other pages. I have the logo as a .png already on the page and would like people to be able to see the static logo without flash.

    How can I;
    (a) mark the stop animation when the sound is completed (currently it loop a piece of sound and animation loop)
    (b) make the flash animation appear to be those with flash and the .png to those without?

    I don't know if it's relevant, but animation is a glow with the ActionScript 2.0 and the sound is something that I imported to a second 'layer '.

    I download your file and make a few changes. You can download the modified file
    here. (I'll delete it tomorrow)
    You put your sound on a layer - that's why he plays independently. You must set link for object Intro in the library, attach its object of music and then read it. (Or you can remove the library Intro and plays as flow of your server)

    Music = new Sound();
    music.attachSound ("intro");
    Music.Start ();

    That's all!

    If you want to stop the animation on a particular phase, do not stop it here:
    music.onSoundComplete = function()
    {
    _root.box_mc.onEnterFrame = null;
    }

    but he just set a flag and stop the animation inside the onEnterFrame function.
    music.onSoundComplete = function()
    {
    flag = 1;
    }
    and inside onEnterFrame - set something like:

    If ((box_mc.blur > = 30) |) (box_mc.blur<= 4))="">
    if(flag==1) this.onEnterFrame = null;
    }

  • complete the loop and get data

    I need to acquire the acquisition values of data every x seconds. Waiting in the loop of data acquisition is defined so that the next N samples are acquired after x seconds. Pressing stop the loop of consumer DAQ stops after the sec x which is connected to the wait function.

    1. how to stop the inner loop immediately when you press a stop?

    I also write acquired samples after doing some calculations on the samples.

    1. plan of sample of the queue to file consumer loop. Is there any other recommendations such as drop loop is not without samples? How many data can an expectation of the queue?

    Thank you.

    sonotk,

    You've missed the point. Rather than having a 5000 milliseconds of wait, use an expectation of 100 ms and count the number of times that you have been waiting for 100 ms.  When the count reaches 50, sample and start the count again.

    The counter is just in the shift register containing an integer. Inside the while loop you have a box structure. Test the shift count register to see if it is 50. If set to True, use the real case of the structure of the case. Inside, it's all in your loop except waiting and the logic of the judgment. In the case of false, you add 1 to the shift register and wait 100 ms.

    Looking at your picture code once again, it seems that the shift with TempData and VoltData regsiters are not necessary because you never use the data previous iteration on the left side.

    Ranjeet,

    Make a simple VI with two loops and some expectations.  Run with execution highlighting market to see what is happening.  It is a good learning tool.

    Lynn

  • Always leads when I stop my loop

    Dear all,

    Now, I used OR-6008, when I used case structure of program via the digital output. You can turn on and off. But when I tried to turn it on, then stop button while loop. The light that I connect to is always when I stop my program. How can I turn off which led when I stop my program?

    Thank you

    1. your outter loop is not necessary at all.

    2. you have a lot of duplicate logic.  If you're not over your threshold, of course you will be inferior to her.  If you can do a lot to reduce your logic.

    3 things will make a lot more sense if you convert your DAQ meter data immediately after the DAQ Assistant.

    4. move your writing digital output outside the structure of the case.  Also allow the timer to influence the case which is called.  In this way, you can tell the exit to go simply false when your stop the loop condition is met.

    5. as you collect only 1 analog value at a time, change your chart to a graph.  A graph has a history built into it, which I'm sure you would like to have.

Maybe you are looking for