How to pause and resume a while loop with a button

Hi all!

I'm back in LabVIEW, after only a few years and I cannot understand, what at first sight seems to be a simple problem!

All I want to do is have a while loop in which, for the purposes of illustration, I have the 'random number from 0-1' function on the inside, and I want to be able to pause and resume this help from a button. There are a few other posts on the forum that are very similar and do use "event structures. The problem I encounter is that I can get the genarator random number to start the generation but the break will not stop this!

I have the feeling that I made a stupid mistake - but I can't understand or google my way out the problem! I enclose my solution so far!

See you soon!

I did an example (you can drag and drop the image into a labview diagram > = 2014)

hope this helps (I just did 2 excerpts, it's the same program)

Tags: NI Software

Similar Questions

  • How to pause and resume the loop that should contineously loop runs?

    I have a request that a loop runs continuously and when I call this loop must stop iterating when I call this loop, it must return to the iteration. How I can implement?

    Can someone help me?

    You don't want to pause and resume the while loop.

    You want a part of your program to suspend and resume.

    You can make a machine to States in which break do not run your code and resume starts executing your code you are. Change of use part to hold your data.

    Another thing if you just want to implement the pause and resume you can use events with value-1 timeout and some time.

  • How to pause and resume the chronology

    HI -.
    I have a main timeline which is long some 900 images. During this 900 frames I bring in short MCs on their own layer which play their duration - (a frame 90 MC gets 90 frames in the main timeline). There is also an audio track embedded on its own layer.

    What I have to do, is to be able to pause and resume the main scenario - including audio and everything plays MC short.

    I did a PlayPause button. I do respond to an onRollOver and onRollOut onRelease (it climbs at different times within himself to change his appearance). But how can I do control the main timeline to pause and play?
    I don't know if it is useful or not, but here is the code I use.
    TIA your help,
    JL


    Try using _root instead of root

  • How to pause and resume...

    I am creating a module and would like a pause and resume button. In this way the user looks at a module be able to suspend and then be able to click on the button to view the module where they left (similar to the Conrol + P when you CREATE a piece in Authorware). The training module will consist of a timer (wait icon), so if they do not click on the pause button it will continue on the next page.

    I have currently a problem to have the button resume. It is for the button back to play since, when I click on the pause button.
    If someone could help me with this, it would be a great help.

    Quote:
    Posted by: newsgroup user

    "V1ck1_D" wrote in message
    News:fcmh8g$3BC$1@forums. Macromedia.com...
    > Amy Merci for your help. It worked. But I also noticed that you
    > included
    > audio,.
    > there are more than that. I forgot to mention, but I assumed that it
    > would have stopped the audio as well.
    >
    > There was someone who posted a similar topic as mine
    > who wanted to do the same thing and noticed that you answered
    > back (audio) with this:
    >
    > "If you want to pause the media as well, you will need to put this at the top."
    > of
    > each page frame in a calc:
    >
    [> Medialist: =]
    >
    > Set this code on each icon in media (sound/film)
    >
    > AddLinear (MediaList, IconID)
    >
    > Then, before your interaction on the page to Pause, put this code:
    >
    > repeat with x in MediaList
    > If MediaPlaying@x then Mediapause (x, true)
    > end repeat
    >
    > In the infrastructure of page break output pane, you will need this
    >
    > repeat with x in MediaList
    > If MediaPlaying@x then Mediapause (x, false)
    "> end repeat."
    >
    > I tried, but it doesn't seem to work. I'm assuming that
    > This is something that I did wrong. But with the meaning given
    > above, there are all the changes need to be made when
    > I do it myself?
    >
    > If you could help me with this, I would appreciate it.

    Send me an email list
    Amy (at) authorware-amy (dot) com.

    Make the topic:

    Authorware MediaPlaying list of break room

    In this way, you don't get deleted as SPAM.

    I sent you an email earlier. If you haven't, let me know.

  • How to exit while loop with delay schedule?

    I have a pretty heavy program that iteratively takes a series of measures from a number of channels using a variety OR-Switch and OR-DMM screws that I assembled as a result of various examples and several help pages. Each channel is sampled once during each iteration with data to be saved in a text file for later analysis, after it is imported into Excel. I added to the screen 'real time' indicators and charts to see what looks like running data.

    Each iteration is performed using a While loop with a delay timer, even if a previous version, I used a timed loop. Measures for the series of channels are collected with a loop For inside the While loop. The loop For includes screws which:

    1 cut the channel and wait as debounce.

    2 Initializes the DMM and passes the configuration information.

    3. wait for a while to make sure that the DMM is set.

    4. measure.

    5. close the DMM.

    6 disconnect all the switches.

    The terms of the election of the channels is ends in 15-20 seconds and I am currently collecting data every two minutes, so he spends "wait" time "collection". Each iteration of the loop For initializes and closes the DMM to avoid the hot switch.

    Other components of the program are configuration setting controls, etc. (in front of the While loop), a "current measurement" indicator and a writing-text inside the loop file operation For, several indicators of the iteration (inside the While loop, but outside the loop For) and a bunch of operations related to the grouping and table that provide graphics of groups of time vs measures.

    I don't know there are more elegant ways to perform many functions that I do and I'm not posting the VI here because I want to concentrate on what I know, it's a big problem with my program (for now!) - I can't figure out how to get out of the While loop. I tried the combinations of Boolean control, its conditions of latch and Stop / continuous if true to nothing does not.

    I want a 'Stop' button that ends the While loop, at the next opportunity, but it is not working properly, I think, because the stop button does not play with good timing, because the program runs either the loop For or the time delay at the beginning of the While loop. 'Next opportunity' can mean 'Immediately', 'at the end of the next iteration of the loop,"or"at the end of the next delay schedule." I think that if I get one of these scenarios to work, I can get an any of them to work!

    Help, please!


  • How to get out of a while loop?

    How can I get out a while loop?

    I'm new to Labview and I tried to make my first Labview program.

    I took an old example, a sieve to primes. The old Erasthotenes sieve.

    Similar to (Visual Basic example):

    While (l<= k)="" and="" teiler=""><=>

    Teiler = TeilerArray (l)

    Hans,

    What you linked is for the loop FOR, that I had attached is for the WHILE loop.

    Only the type of the loop is different, but the concept or the logic is the same for both.

  • While loop with reading of text file - calendar of events in a given period

    Hello world.

    I created a program that if serial interface via a port to a syringe push in my lab. Currently, the program reads in a text file-flow rate values and sends them to the pump, one by one, through various commands. I need to ensure that whenever a new flow rate value is sent to the pump, it does in a specific/hard time for a while. I.e. every 0.1 seconds, changes in flow rate and must are active until the next period. I tried to use a timed loop and I think I've succeeded, but it hogs system resources, so I was wondering if there was a way to do it using the number of cycles or something of this nature. I just started using LabView, so I'm slowly getting the hang of it (easy when you watch my VI!)

    See attached VI. I took orders from serial port and have instead orders display in an indicator. The nested and densely populated while loop contains the commands that need to be completed/last during the period (like 0.1 second).

    Thank you for your time and help!

    -Phebotalus

    Hi, you should read some introductory material on LabVIEW to down the idea of the stream.

    Basically, the data flow in the wires from left to right, and any node will not work until it has reached all of his contributions.

    The thread of the error is the best way to run data streams.

    ***

    In your VI I use data wires, their execution through structures, and forcing the structures to run in the sequence.  Using a structure of sequence you mentioned in your next post will force the two scripts to execute in the order of (the only one we discussed to be in race condition.)

    Similarly, for brevity, I would wrap the EMO and she is business structure in a single sequence and force it to run last using stream.  In this way the user has the most possible time to decide to hit the EMO before she is called by the application.  As it is now, it most likely is interviewed at the beginning of the loop, so if it's the exchange value you won't see results until the next loop.

    When running in execution of highlight you see the order of data flow, but that is not guaranteed to be the same for a normal performance, where the use of the data stream.

    ***

    The counter tick account ms up to a very large number and then "says" reset and start counting again.  I know you want to START the loop as close to every 10 ms.  Yes, using data flow, take the number of cycles first, perform actions, then return the number of cycles.   The second time of the tick read that you are in a nested loop that does not stop until you get 10 or more difference on the number of cycles.

    And, on the off chance that you must achieve "return" on the tick counter comes stops the nested loop then move.  (if the second measurement is less than the first, then the tick counter handed.  If you miss this situation while you'd have to wait a long time for the condition of the difference > 10 in the reunion, basically locked in the loop.

    ***

    You could put the EMO sequence, we have seen, in line with data streams.  Before or after the second control of ticks will not make much difference in terms of 10ms.  I would put it after checking the tick, again give the user more time to hit the EMO if necessary.

    ***

    I put in a queue for the stream error and removed the other stuff.

    LV2010

    Check out some of the LabVIEW intro docs, they are online, they discuss these issues and much more.

  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I use a structure of the event to do so, but it seems not elegant or the right way to do it.  The only way I could get to the kind of work is by unchecking the lock front panel in case of structure.  I have attached a sample vi of what I have so far.

    The problem is that you can't even stop the program by pressing the stop button until you exit the tab, which is not a user friendly interface.

    The event should just manage basic user events.  Any given event does not take a lot of time to run.  While you are in the diagnostics tab, your code is stuck in this while loop.  Although the setting of the front panel of the lock allows you to do other things, the LabVIEW is just put on hold all these other events of the UI (like Stop button value change) and cannot handle them inside while the loop stops and allows outside while loop to go through again.

    You should have a parallel while loop to manage waveform graph.  You can use notifiers or queues or a motor of action FGV (see Ben Action Engine Nugget) to switch the starting or stopping of the update of the chart of waveform until the parallel of while loop.

  • 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;

  • Control and Simulation in a loop / while loop with TCP/IP reading / writing of synchronization

    Hello, I have a problem with reading TCP/IP and written in two loops. The problem is NOT to get the two loops to read and write to and from the other. This has been accomplished. My problem is when I run control and the loop simulation on my laptop and the while on a RTOS remote on the controller on-Board of LabVIEW in a remote PXI chassis, the while loop the remote system running on four 4 times faster than the loop control and simulation on my laptop. In other words, for each iteration of the loop control and simulation on my laptop, there are 4 four iterations of the while loop on the remote system. I need to know how to get a degree of kinship (1:1) with these iterations of the loop. When I run a longer simulation in real time, say 10 seconds, the control and Simulation loop begins to slow, i.e. the simulation time slows down until it is no longer in real time and the "Late Finish"? Parameter is set to true and the LED lights and continues to stay lit. At this point, the system destabilizes due to what I believe is being well sampling rate too discreet and I have to end the simulation. How can I get a ratio of one to one between the loops and also to avoid slowing the loops causing destabilization?

    To give an overview of my application, I implement a control system in a network, seen in "image2.png". This is achieved using my laptop as a subsystem 1. Reference signals are generated from the laptop and the error signal is produced. Control measures taken and the control signals are sent via TCP/IP to the remote system. Position feedback is returned, and the process repeats. My system has Core I7 Procs w / 3 GB of RAM, up to 1 GB/s speed via ethernet and LabVIEW 2011 installed with all necessary modules and networking tools. The attached VI Custom_Wireless_Controller works on my laptop. The remote system I'm working on that has the 7830 NI R Series with FPGA card. OTN runs on the PXI chassis with an enbedded controller that has networking capabilities of up to 100 MB/s via ethernet. I use the FPGA for the acquisition of data and apply control signals to my plant. The plant is the PCE twist connected to the FPGA through the cable of the ECP - RIO of NOR. Subsystem 2 is this side of the CNE. The FPGA collects position, he sends to the controller via the network, receives signals from the network drive and writes signals to the plant power amplifier that operates the plant. This process is repeated and the VI and is titled Custom_Wireless_Plant.

    I appreciate the help really and look forward for her and for any question!

    Well, the first step is to understand what you have set up right now. Your control and Simulation loop on the side of the controller is configured as 'Runga Kutta 4' and you have a loop timed on the other side. In addition, you have the primitives of TCP/IP on the control and the Simulation diagram and means he will perform (a message) on the size of each minor step, which in your case is 4.

    So, you have two options:

    1. replace the Solver side controller Runga Kutta 1 (this must synchronize loops)

    2. hold RK 4, but create a Subvi around two primitives of TCP/IP and configure from the VI to run than the major (continuous) step-size. If you do it right, you should see a 'C' on the upper right part of the VI you have created.

    Please let me know if what I said is not clear...

  • already launched patch pause and resume

    Question - a patch was already underway, but we had to be applied another patch before applying the patch already running. How we start paused the patch so that we can apply the second patch and resume one later?

    Richa salvation;

    As I remember that this steps mention in metalink note, so its procedure known, I have try 3 times and all fail :). That's why I suggest stop patching apply prereq and start again from patch :)

    Respect of
    HELIOS

  • Suspend and restart a while loop

    Hi all

    After a few TAPI, this is my first post here.

    I need to write a simple VI with three buttons on FP: 'Send', 'do not send' and 'Stop '.

    'Stop' execution of termites. 'Send' starts sending that one CAN frame on NI USB CAN every 5 seconds. 'Do not send' suspend the CAN communication without putting an end to the VI.

    I am not able to find a way to "suspend" the CAN in a loop and then to spin again, I tried to use the queues and the structure of the event, but I can't find a solution to this problem.

    I've been searching the net but without success, for example This example is not appropriate because 'stop' does not work when 'pause' is true.

    Can anyone of you please give me any suggestion / link?

    I'm under LabView 2011 on PC Windows7.

    Thank you

    Andrea

    Thanks Ed, he now works as I expect.

    This is the code:

    Do you think it's a good solution or there is a "more clear" solution or better somehow to do?

    Once again, a big thank you to you two

    Andrea

  • loop for and while loop with empty table entry

    Hello

    I have a question with loop and loop.

    When a constant empty array (zero element) is connected to the loop For with "allowing the index", there are no interactions performed in loop For. But, if the loop is replaced by any loop, no problem.

    LabVIEW 2010

    Hello

    It is ok. I have no problem at all.

    For the 'loop' For when you connect the table thanks to indexing, the number of iterations is set to the size of the array. The iteration number assigned to N (in your case 10) is ignored.

    For the 'While' loop the number of iteration is defined by the Boolean Condition and the size of the array is ignored.

    Paul

  • How to record data using a while loop?

    Hello

    I created a .vi I try to use to record several channels of data. I have implemented the user must be able to record data until the "STOP" button is pressed, then the data is saved in a spreadsheet file.

    Question No. 1: How to allow the user to store an indefinite amount of data?

    If you run the .vi as is, you will see that you are only able to collect 100 points, and registration takes place during Ms. I want to collect about 5 minutes worth of data and have a sampling frequency of 1 kHz.                 Any suggestions?

    Question 2: How can I change the worksheet file extension? Let's say I want than to save it as a .csv file?

    Thanks in advance for any pointers or suggestions!

    I have not looked at your code, but only based on your description I would implement a producer/consumer to save your data.  You must acquire your data in a loop (the producer) and send to your loop of logging (the consumer) using a queue.  Yes, you must save the data, then that is acquired.  In this way, you do not have to worry about storage who knows how much data in RAM.  It's just the disk as soon as he can.

    You can save the file with whatever the desired extension.  If you want it to be a CSV file, then do the extension a .csv.

  • DMA2100 pause, fast forward and resume won't work with video files.

    Hello

    I have the extender DMA2100 working with and Win7 media center movies streaming absolutely perfect.  The problem I get is when I try to pause for more than a few minutes or go out to a movie and try and resume, which until the beginning of the film! It's so frustrating to anyone can help?

    Hi Scottking69,

    There are questions about the compatibility of Windows 7 and DMA (as a few years ago). Linksys/Cisco, it has been verified that it is NOT officially supported. But some do work but not at full capacity. Hope that this would settle the question whether it is supported or not.

    See you soon!

Maybe you are looking for