How to stop a while loop after certain time using Elapsed time vi

how to stop a while loop after certain time using Elapsed time vi.

Hi Frankie,
Just place the Elapsed Time VI inside the WHILE loop, and wire the 'Time Has Elapsed' output to the conditional terminal in the lower right corner (which should be set to 'stop if true' by default).
In the future, please post your LabVIEW questions to the LabVIEW Forum.  You have a much better chance of getting your questions answered sooner, and those answers can then help others who are searching the LabVIEW forums.  Thanks!
Justin M
National Instruments

Similar Messages

  • How to stop a while loop in LabVIEW from a C program

    How to stop  a while loop in LabVIEW from a C code

    hi
    I think by creating dll you can stop the while loop from your C program.For that you just create dll (Dynamic Link Library) for the VI which has that while loop.
         Anyway can u please explain ur requirement clearly.

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

    Hello;
    sorry for my english
    I have to stop a subvi from my main vi, the subvi contains a while loop and an event structure so I need to stop this loop while directly from my main vi I have tried global variable but it did not work
    any help please or example !!!   
    Solved!
    Go to Solution.
    Attachments:
    stop a while loop and event structure from main vi.png ‏16 KB

    IYED wrote:
    Hello;
    sorry for my english
    I have to stop a subvi from my main vi, the subvi contains a while loop and an event structure so I need to stop this loop while directly from my main vi I have tried global variable but it did not work
    any help please or example !!!   
    If this is an example of how your code looks, I'd clean it up before the developer who has to work on it next hits you over the head with his LabVIEW Style Book. 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to stop a while loop when using tab control

    How do you use a tab contol to stop what is happening on one tab when you switch to another tab?  In the test example I attached, I have a while loop nested inside a case structure controlled by the tab control.  When I tab to page two the elapsed timer starts but when I switch to another tab it does not stop.  I can't come up with an easy way to stop or exit the while loop when I change tabs. 
    Thank you
    Danny
    Attachments:
    tab control.vi ‏24 KB

    I played with it a little more and came up with this fix.  This fixes it but is not tied to the changing tabs as I was looking for.  Is this just too many nested loops and a bad idea?
    Danny
    Attachments:
    tab control fix maybe.vi ‏26 KB

  • How to stop a while loop with long delay

    Hi everyone,
    I am building a simple program for turning on and off a single Bit.  The task is to turn ON the Bit for a period length T1, and OFF the Bit for a period length T2. T1 is normally different from T2, and can be controlled  by users. 
    Since T1 and T2 can be variable, they sometimes can be very long.
    If I use a Wait function inside a While loop, it needs long delay to be able to Stop the Main program.
    The same situation happens when I use Timed loop.
    Can anyone suggest me how to do this task?
    Thanks a lot. 
    Message Edited by tatuan on 04-12-2010 12:56 AM

    Here's another possibility using OpenG Wait ms:
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to stop a while loop which contains a timed loop

    Hi,
    I'm a new hand to labview, and I'm using labviw 7.1, NOT 8.x.  I'm trying to do a measurement, in which the flow would look like the attached file (I have stipped all hardware related components to make it easy to read).  My questions are:
    1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
    2. When it is running, I click on stop button, why it won't stop?
    Thanks!
    Attachments:
    SyncTimedLoop32.vi ‏228 KB

    hwm wrote:
    2. When it is running, I click on stop button, why it won't stop?
    The stop button is read outside of the inner while loops.  So the inner while loops will continue to run until their stop conditions are met.
    hwm wrote:
    1. In Loop 3, when the comparison (x>20.85) is true, Loop1, Loop2 and Loop3 are stopped, why it won't quit the while loop (I have wired it to  while loop stop)?
    It seemed to me like it would, but sometimes it seemed like I had to set change the numeric value one more time before it would.  You have a very odd structure there by placing the event structre inside the while loop with the other loops.  I think you may be running into issues where events are getting queued up in the event structure, or race conditions between when the event structure might execute relative to the other loops.  It is all very odd and difficult to predict all the ways these structures might interact and relative timing.  Usually event structures would belong in their own parallel while loop.  I think you need to rethink exactly what you are trying to do here.  It probably isn't event necessary to use the stop timed structure functions.  A local variable or a notified to pass the "Stop status" from loop 3 to the other loops (or the separate event structure loop to the other 3) would probably be better.

  • How to stop the animation at a certain frame using action script 3.0 .

    How to stop on a frame to stop the animtion using adobe flash cc.

    Either put a stop(); command in the desired frame of the animation's timeline, or have an ENTER_FRAME event listener working who's event handler function constantly check the currentFrame value of the animation and issues an animation.stop(); command when the desired frame is reached

  • How do i stop a while loop

    I'm new to labview and I'm having a problem stopping a while loop (running windows XP/2000 with the student edition of labview express 7).
    I'm doing a data acquisition program where I'm constantly reading in voltage and comparing it to a set point value, when the input voltage goes above the set point, i want the while loop to stop. How do I do this? I already have an LED going on when the criteria is met, but I'm not sure how to actually stop the loop (i.e. change the iteration value from true to false-i guess). If anyone can please assist me with this I would very much appreciate it.
    I've included my program too.
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

    Hello Everyone-
    I've just posted a message about stopping a while loop and it was answered accurately and quickly- thanks to LV_Pro and PauloM- thanks much- its nice too see that there are many helpful people out there! Unfortunately, I have 2 more questions to ask of the forum.
    My application is almost completed- I just need to add an elapsed time counter that will tell me how long it took for my LED to trigger (from my set point-i.e. when from 0:00:00 until when my loop stopped).
    Now I've found a perfect elapsed time counter on the NI web site contributed from Mike Hall from Ohmeda Medical- the page is here.... http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=D37E2493DC333076E034080020E74861&p_node=DZ52032&p_source=external
    So my first question is, it looks like I can just extend the while loop box in my 'CO detector... .vi' and paste just the code from the 'elapsed time.vi' while loop into my loop and I will be set- but do I need to change my wait until next multiple to be a 1000 too in my program? Probably, but I'm not sure hence the question- or other ideas would appreciated.
    My second question is now that my application is complete (after I add the elapsed time above), I need to exactly duplicate this process for 7 other DAQ inputs (i.e. right now I'm using only 1 of 8 analog inputs on the FP-AI110). So should I make my 'CO detector.. .vi' a separate program (I remember reading something about this in one of the posts earlier).
    Any help is very appreciated.
    Thank you again,
    Daniel
    Attachments:
    CO_Detection_Monitoring_System_Modified.vi ‏60 KB

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Pause and restart while loop after defined time

    Hello,
    What I need is to find a way to run a while loop that is acquiring and analysing a movie, to pause this while loop for a time I specify, and re-run it after that time has passed.
    I'm attaching a picture of the relevant parts of my VI. In the case structure of the "true" or "false", the program is checking, online, if the eye (my camera is focusing on the eye) is open above some threshold and for a certain duration of time. When "condition to start" is met, two things happen: one, the case structure changes to "false" and waits for some time; second, the loop of my state machine is triggered. Problem is, because I'm not really pausing my while loop (it's still running even when it's the "false" case), my state machine runs really slowly - for example, I have a part of video acquisition in my state machine, and saving the frames to avi takes forever. 
    Does anyone have any idea of how I could stop the while loop for x time?
    Thanks in advance!
    Attachments:
    help_pauseWhileLoop.png ‏112 KB

    Hi,
    I'm attaching (hopefully) better pics, if you still can't see let me know and I'll attach the code. About the frame saving and acquistion, I'm already doing that in a separate loop - you can't see my entire code in the pics, but what I have is a state machine that works as a producer loop and then a consumer loop, where video acquisition is happening. Now I'm working on a third loop (the one in the picture), that starts before the others and where I don't even want to save the movies - I just want it to check, online, if the condition is met (e g, the eye is open for a specified time) and if so, start the state machine and stop running, until the state machine has finished running. Then do the same, after waiting a specified time. I know that the problem is that the while loop keeps running after triggering the state machine, because if I remove that part and trigger it manually, the VI runs just fine and really fast. So how can I run, stop and restart the while loop?
    Attachments:
    help_pauseWhileLoop1.png ‏56 KB
    help_pauseWhileLoop2.png ‏32 KB

  • Code golf: stop two while loops with guaranteed iteration ratio

    Proposal
    In the vein of the Perl tradition, I'd like to see if there's any interest in solving short programming puzzles in LabVIEW. Anyone can post a problem and define the rules for solving it.
    Here's a beginning/intermediate question to whet your "palette".
    Description
    With one user-action, how would you stop two while loops such that the ratio of their iterations is the always the same? One concrete way to visualize this situation is in taking measurements: two instruments use the same timing source to take measurements, but second divides the clock down so that it is an integer factor slower than the first. For example, if the slower instrument is four times slower, then at the end of the VI, if the slower instrument takes 100 measurements, the faster instrument has taken 400.
    Rules
    You may only use vi.lib
    You cannot include any other subVIs
    Your solution must pass for loop1 interval as low as 25 ms
    Template (attached in LabVIEW 2009)
    If folks are interested in this, then let's figure out how to make future problems better. Please post your suggestions and critiques, but only if you also post a submission ;-)
    Solved!
    Go to Solution.
    Attachments:
    Multirate Loop Code Golf.vi ‏11 KB

    Norbert_B wrote:
    a) You work with an integer factor of speed. While this matches many application areas, there are still cases where the factor has to be floating point (e.g. 2.5). Additionally, the factor might "invert", so the master loop runs slower than the slave (factor 0.5 for instance).
    It sounds like you're about to post another code golf question. If you think the problem scope is too small, you're welcome to fashion one to your taste. Thanks for volunteering :-D
    Norbert_B wrote:
    b) This example does not take into account that the hardware has to be synchronized with more accuracy than the software supplies (PXI?). If hardware synchronization is required, there are two possible ways:
    - The factor can be included in the synchronization (using PLL for instance)
    - The factor has to be software implemented by data reduction for the task running at the lower pace.
    Hrm, maybe puzzles aren't really your thing after all. You are correct: I did not define every constraint that can lead to a provable best closed-form solution, but that does not prevent people from stating their assumptions and forming creative, well-reasoned, and still correct designs. I overlooked this reading of the description and neglected to add a statement that said solvers were free to add their own conditions. I will do so in the fugure :-)
    If we choose the first of your suggestions, the VI must still retrieve the data at different rates. You can dedicate a loop for each instrument to decouple any jitter and latency introduced by their connectivity or internal operation; this adds some margin of safety when there is thread and driver contention. You can also implement a single counting loop like altenbach and forego the multiloop complexity.
    Norbert_B wrote:
    c) You don't state anything about "what happens with the data". Is this time consuming? Does it introduce additional delay in loop iterations? Is it OK to have data loss?
    I don't know -- you decide, you disclose, and you solve :-)
    In my specific situation, the measurements are time consuming and do add delay (each data "sample" is 5-20 megabytes), none can be lost, and the data must be available for others to analyze later. In addition, the amount of data is saturating the hard disk throughput. If a particular write takes too long, the instrument driver may overwrite a yet unfetched sample, which is unacceptable. I did not add these details to the problem discripton becuase they don't impact the puzzle.
    I don't want to burden people with my situation and ask them to solve my problem: I want to encourage them to bring their intuition and experience to a discussion. This is the design process at its heart: understanding why and how constraints affect your decisions. If a person states the additional conditions they've assumed, readers can learn why, and more importantly, when a Notifier might be more desirable than an Occurance or a Queue more robust than a Data Value Reference.
    The best NI-published advice for stopping multiple while loops (https://www.google.com/search?q=labview+stop+multiple+while+loops) is laughable (and is the "solution" in my template).
    Would you care to re-approach and contribute to this puzzle? I suspect you have a lot to offer :-)

  • Stop multiple while loops in Vision Aquisition

    Hi,   I want to close multiple while loops with one stop button. I'm using the Vision Acquisition software for recording from multiple cameras and I want to close this recording from all cameras simultaneously. Since I'm knew to LABView I don't know how to do this. I'll include my VI here and maybe someone can help me.  Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Aquire Images 2 with Cameras.vi ‏410 KB

    A local variable should be enough for your implementation. Look at the following article:
    Stopping Parallel While Loops in LabVIEW With One Stop Button
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • How to stop the spinning  ball after trying to install 10.7.3?How

    How to stop the spinning ball after trying to install V10.7.3?

    Boot from your recovery partition by holding down the key combination command-R at the startup chime. Release the keys when you see a gray screen with a spinning dial.
    When the Recovery desktop appears, reinstall the Mac OS. You don't need to erase the boot volume, and you won't need your backup unless something goes wrong. If your Mac didn’t ship with Lion, you’ll need the Apple ID and password you used to upgrade, so make a note of those before you begin.

  • Stopping a while-loop in a sub-vi

    Hello,
    I want to stop a while loop that runs in a sub-vi. It does not work with a local variable, is there a possibility to implement this without using global variables?
    Many thanks !

    One way is to use a notifier.
    See attached - Uses LV 7.1.Message Edited by NeilR on 05-04-2005 08:10 AM
    Attachments:
    stop2.zip ‏14 KB

  • Memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    memory requirement is continiously increased when i am running my application program in an infinite loop,after certain time it shows an error called low virtual memory

    What are you doing with your program. Lots of improper programming techniques can cause this - building arrays, concantanating strings, opening but not closing refrences, etc. Need more details or post your VI. Also, have you looked at "LabVIEW Performance and Memory Management"? It's part of the shipping documentation and available from Help>Search the LabVIEW Bookshelf.

Maybe you are looking for

  • HP 6300 ALL IN ONE NOT PRINTING

    MY HP 6300 ALL IN ONE IS CONNETED TO MY AIRPORT EXTREEM. I CAN NOT GET THE PRINTER TO PRINT. THE PRINT DOCUMENT LOADS AND SHOW THE PRINT JOB PRINTING BUT NOTHING HAPPENS. I HAVE THE PRINTER CONNECTED TO THE AIRPORT EXTREEM VIA ETHERNET. THE PRINTER W

  • Upgrading iMac G3 400 DVD slot-loader to Tiger

    My iMac's hard drive is dying and have purchased a brand new Seagate Barracuda 7200 8MB cache 120GB ATA IDE hard drive on eBay to replace it (haven't received it yet). Also am going to replace the PRAM battery and add 256MB of RAM. The Mac currently

  • Ken Burns effect

    Under Snow Leopard 10.6.8 I am using iMovie '11 version 9.0.4 (1634). Making for the first time a movie out of iPhoto pictures, with lots of effects (transitions, titles, etc.), I experience in the use of the Ken Burns effect that any zooming ('in' a

  • Set width of custom control

    Hi all I have a cl_gui_custom_container in a dynpro. I would like to manage width of it. I tried to use method set_width, but it does not wrk. I try the get_width and it works. What am I missing? Is it possible to achieve width management? thanks Gab

  • SAFARI not displaying webpage

    Hi, I'm a librarian, who posts exam papers online using our library system. The exam papers display in firefox, and ie7 but not in safari. The link is:http://library.itsligo.ie/search?/rexampapers/rexam+papers/1,9,9,B/l962~1052226&FF=rexam+papers+bus