Simple question: timed period while loops

Hello

I have a timed loop, and if the user presses a button "repeat" loop runs until 'repeat' is set to false. I want the loop to iterate over a given period, including user input. Inside the loop, a square wave pulse is created based on the parameters provided by the user, then displayed on a waveform graph.

However, when I change some of the initial settings of the square wave, for example from tension, the waveform graph is updated instantly. I want the waveform graph only be updated based on the period provided by the user, all say a second. I tried to set the period of entry into different amounts of 10000 a.0001, but always updated at the same time waveform graph.

I'm not sure what I'm missing, but I'm sure it's something trivial. My VI is attached. Any help will be appreciated.

I don't understand what your problem is.

If I run your VI (and hit the repeat button firstly, otherwise VI blink tracks then stops) and make changes to tensions, duration or delay, it will take a little time or a lot of time according to the what is the length of the loop, and where I do the modification to controls during the delay of the loop.

(With a period of 5000 milliseconds, a change can take up to 5 seconds to show in the event where you make the change right after the beginning of the loop.)  «(Or it may take a fraction of a second if you make the change just before the loop iteration ends).»

Maybe you can give us a configuration of the parameters, we should enter each controls (even better puts these settings yourself, do the default values, and then save the VI before posting) as well as specific guidance on what we should do to recreate all that is your problem.

Tags: NI Software

Similar Questions

  • Two questions in table "While loop"

    Hello

    I have two questions about creating tables in while loops. I'm using LabView 8.5.1.

    In its simplest form, my current while loop (delay set to 0, 2 s) has 3 variables that have been changed by moving a slider. They are each sent to a line in a block of 'Building the table' (data type is DBL 1 d) - this table is then written to a spreadsheet file, such as the three values are written to a new line (one value per column) whenever the while loop runs.

    Question 1

    How can I add a column 'Time' in this worksheet? In other words, get at the present time the loop works since then, from 0 seconds in the spreadsheet, via the table block building.

    I can think of how to do this with a loop For, but given that the While loop runs through an unknown number of iterations, I can't figure out how to get the counter to work.

    Question 2

    How can I text column headings on the worksheet?

    Thanks for the help and if you need anything anyone stating, please let me know

    To answer question 1:

    There is a function of 'Elapsed Time' you can put as the first colum of the data.

    This then reformatted your spreadsheet as
    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    etc...

    To answer question 2:

    Build a table of positions, then write this table in the file only once, outside the loop.

    Your table with the data and time will write inside the loop.

  • While loops inside while loops, how to stop?

    Hey, I'm confused with a simpler question to multiple while loops. My goal: stop or pylone2, just jump out of the small loop and stay in the big one. and if I click on stop 3. the entire program would cease... How can I do this? The following script does not at all... Thanks in advance!

     

    Yes you are completely right Mike... now, I solved the problem with another structure of the event and the Boolean variable local... Thank you very much!

  • While loop inside a timed loop

    Hello world!
    I use:
    -LV 7.1 + real-time;
    -compactFieldpoint;

    When I put some time, I noticed a strange behavior, loop inside a timed loop.  Let's fix loop timed with these settings:

    -Clock 1 kHz
    -1 ms period (Yes, I know it's short...)
    -offset 0 ms
    -Stage 0
    -Take the period of absence (ON) and maintain initial Phase (ON);
    -Timeout:-1.

    So, inside the loo, I put a traditional while loop, waiting (for example) an event will occur, and if this event doesn't happen, my cFP-2020 crashes! I mean, it becomes inaccessible for the debugger, and also, if I run a ping at his address, after a few cycles it becomes inaccessible as ping!

    Obviously, that statement of code lock the fieldPoint, because if I remove the inside while loop all work.

    I know that with 1ms duration, timed loop always the finishing of the delay, but I put the scrapping period missed and timeout-1.
      
    It seems to me that sometimes timed loop add overload heavi programs, I all so that the loop according to the tasks, even if my application has be in real-time!

    Tips welcome! Good day!

    Graziano

    Thank you very much for your answer!
    I'll test the entire application and then look for the best practice... but I still think I'll replace it timed with while loops loops...

    Good day!

    Graziano

  • Is it possible to execute a loop For independently within a while loop in LabVIEW 2013?

    In my program, I want to run a loop For inside a while loop and run independently, at their own rate of execution.  A test, I wrote a simple VI with a while loop with 1 second calendar and in this I inserted a loop For with 3 of a second.  I created indicators for the two terminals of the iteration.  When executing the VI, I found the while loop waiting for loop For run N times before the while loop is executed again.  I also found that sometimes the first iteration of the loop For ends at 1 second instead of 3 seconds and the STOP button to complete execution of the While loop does not always work.

    This is the expected behavior. LabVIEW is the language of s DATA stream. If you want the curls to be independent, it can be data forcing addictive so use separate loops.

  • What happens when DAQmx - searches read more timed period loop?

    Hi all!

    I'm not sure how Labview manages the following situation:

    I have a loop that is timed with a period of 1000 m, it is configured to ignore the lost iterations and keep the initial phase. I created a task that needs to be read continuously at a frequency of 1 kHz. In the timed loop, there are the DAQmx - read function (analog signal, 1 channel, N samples)

    Now, if I put the number of samples per channel at 1500 for example (while it takes 1500 * 1 ms = 1500 ms > timed_loop_period to read), I noticed that the timed loop takes ~ 1500 ms to complete. The same phenomenon occurs with any other number greater than the period of the loop.

    This means that the period of the loop passes to 1500 ms? Or something different?

    Thank you!

    Best wishes

    Samuel Lopez Santamaria

    You go winding with an iteration of the loop of 2000 msec.

    An iteration of the loop will always be until he has to do.  If you tell him to keep the first phase and it works for a long time, then it will wait until the next 1000 msec happen before going to the next iteration of the loop.

    Now with your situation, later iterations cannot take it any longer.  If you are permanently data acquisition, DAQ mx buffer fills while the loop is still pending.  So when he runs again, there may already be 500 msec value of data in the buffer, and he just needs to wait another 1000 ms up to what you have acquired the total of 1500 milliseconds of data you have requested.

    The situation for the third iteration of the loop will depend on whether the other was done within the 1000 msec, or ran just a bit long.  It behaves more like the first iteration, or the 2nd iteration.

    My question is why you use it timed while loop?  What characteristic of it you need that a regular while loop is not?  I think that mixing and matching the characteristics of a timed, while the loop with your DAQ acquisition will cause a continuously variable behavior time loop which is probably not what you want, or could cause you problems down the road if you're trying to do is to get the continuous acquisition of your DAQ hardware.

  • convert loop timed to normal while loop

    How convert a while loop time normal while loop with exact same properties and performance?

    I have donot need to worry about the exact date. But it takes the timed loop time will be run similar to loop.

    And also, is there any issue encountered when we use Timed loop? problems such as that crashing exe?

    Hello

    1 kHz is the used base clock. Then, you decide to use 10 as period (dt) which is 10 ms.

    The clock is selectable in real-time systems, you can use the 1 MHz clock, giving resolution µs

    But for your needs, using 1 kHz clock with dt = 10 and using a ms of waiting with 10 connected to it is exactly the same.

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

  • Timed loop versus While loop

    Most of the machine control software I design have the following structure:

    1. There's a HAND that takes place inside a TIMED LOOP with synchronization of 50ms and priority of 100. His only job is to read / write data from / to DAQMx IO cards.

    2. the MAJOR can call several SUBs based on the choice of the user, and once a submarine is called FP MAIN is closed and the FP SUB opens. All submarines have a States Queued Machine running within a TIMED LOOP with 50ms timing but with priority to 50.

    3. data transfer between HAND / SUB is through function globals - there are many of them based on past data.

    4. all woks fine so far. No need to any RTOS. and platform of WIN7 is alomost standard. I even ran with a timing of 20ms without anything crashing...

    Problem: When there are a lot of file i/o operations in a SUB partciluar, then I have the chance to see several missed iterations. Perhaps the TIMED LOOP is hogging resources.

    What I want to do: convert both TIMED in asnd SUB HAND loops simple while loops.  But I am concerned by the priority - since the MAIN interacts with HW there priority. But with LOOP WHILE how can I ensure this?

    Or is there any replacement / effective way of doing what I do now?

    Rama wrote:

    .... FGV should be thrown out the window...

    Well used for a while, based on many articles in the KB. One of them is locked... and it does not represent the engine of the Action or of the FGV as a villain to avoid.

    The driving force is one of the largest buildings in LabVIEW.  The FGV who does nothing but Get and Set (or writing and reading) is useless and a waste of resources.  Why?  It does nothing to fix possible race conditions (does not protect critical sections) and it is much slower than just using a global variable.  See this example I put in place to see what I mean: an overview of the race Conditions.

    Rama wrote:

    So in the sample that I had attached, what do you think would happen if I just replaced the two loops with the SAME timed in MAIN and SUB wait value ms. is there a work order then?

    When things are at the same time, there is no such thing as the order of execution.  But as I said, it seems that your loop is quite slow, so it's something I would not worry.  Just make sure that you do not have a loop that uses all the CPU.

  • Timed while loop speed?

    I apologize in advance for not posting any code, but it's a pretty important project and I think I have already reduced the problem.

    The datalogger (below) loop sends a GPIB read the command and sends the data to a queue for writing and the treatment. This VI will run only once, then the sampling frequency is sent only to the timed loop once.


    Stop that VI is shown below, which causes the loop to stop when an error occurs, an error anywhere in the project, or a stop is sent. So if an error occurs in this loop, he would be arrested.

    Now down to what happened. Technicians are coming and says there is an error window that had popped up (they did not save it unfortunately) and the recorder went VERY fast. I have read the saved data, and it shows that at 65 hours in (~ 46980 WHAT GPIB read orders), the recorder suddenly accelerated. He started at 5 seconds reading for much of the race, went to ~1.4 seconds to data point, then blazed on to 0.24 seconds until the end of the trial.

    I do not know the error, but I think it of a moot point now and might have been caused by speed upward. The big question is why my loop suddenly speed up between iterations? Any error 'should' leave the loop.

    I work to see if the error will repeat (65 hours now), but I don't know that I have conducted tests on another machine which has more than 80 hours so I'm not holding my breath.


  • LabVIEW FPGA while loop (first call? (VI) question

    Hi gentlemen!

    I am creating a LabVIEW FPGA VI appearing in a WHILE loop. He has a first call? VI in which, in the first occurrence of the loop, a variable must be initialized to some value. However, when I incorporate the VI in the FPGA, it would seem that the first call? VI has not been called. I also tried this implementation through registers at offset where the registry is initialized outside of the WHILE loop. However, the result is always the same. May I ask how the LabVIEW FPGA functions when it comes to everything IN a loop? Thank you very much!

    For some reason that I don't me remember not I avoided the use of FPGA FirstCall and instead, I use a change sign boolean, son of genuine in the terminal, on the left and a fake in the while loop to the right Terminal. As a result, you get a true for the first iteration only, in exactly in the same way that the function of FirstCall. It could even use fewer resources on the FPGA?

  • Measurement of time in a While loop

    Greetings gentleman;

    I'm kinda new to Labview, and although I sought an answer without assignment, I wasn't able to find one.

    So here my question, I would like to know how I can measure the time a loop sequence, in other words, what time is my point of view VI to run the main loop together?

    A little explanation, the attached VI tries to be a Markov chain, it takes some values in the first case structure based on the previus loop, then, if the values are correct, it passes to the next step and so on. It's pretty simple, and yet, my problem lies in the measurement of time. Since it is a 'distribution', it would take infinite time to execute a simple loop if it does not fulfill the characteristics, but it is scheduled to meet them so an average time should work.

    So, if you look to the while loop, should the big one, I want to measure how long I take for a ride.

    Thanks for the help, I'd be happy to read some ideas on how to measure this.

    Kind regards

    IRAN.

    You will find examples in the example Finder OR by searching for 'speed test' or ' reference '.

    Essentially, you create a flat sequence structure inside of your loop. In the first image, you measure the current number of cycles. In the middle frame, you run your code. In the last image, you measure the number of cycles again and subtract the first number of this. This gives you the run time to execute the code.

    You can see a page of the community about it here.

    There is a high-resolution time tick count VI hang out somewhere which is great for benchmarking and improving efficiency, used instead the number of cycles (ms) primitive.

    Edit - remember where he was

    https://decibel.NI.com/content/blogs/EvanP/2010/10/04/tick-count-us--microsecond-timing-granularity-...

  • Starting with a Cintiq in Adobe Flash - a series of simple questions desperately not found!

    I am completely new to the Flash IDE, but I used my 13HD Cintiq with Photoshop in the past. Despite the Tablet works well and correctly drawing, so far Flash feels very weird and almost unusable. I spent hours searching online for answers to these simple questions, and I found nothing. Help please respond if you can!

    1. Eraser brush size: I have the wacom pen, brush and Eraser gum (pretty standard) value. Can I adjust the size of the brush of the pen in the toolbar, but the gum is stuck to the smaller size! I put the tool eraser for the max brush size, and when the stylus is set on the Eraser tool directly, it is larger. How to set the other side of the pen wacom for a larger size of the brush? And aren't there keyboard shortcuts to increase or decrease the size of brush in Flash? (similar [and] in Photoshop)

    2 zoom brush: changes the brush size when you zoom in. People online say the size of the brush is constant, but it is simply not true. When you zoom to 200%, the brush must be twice as big is in 100% zoom. Is it possible to Flash this (normal) behavior?

    3 timeline packaging: can visit the 'step before an image' and "not back an image" (comma and period) key wrap the entire timeline, so walking to the front on the last image will frame 1 and walking backward on frame 1 goes to the last image? It's important for me to animate well loops, and I can't find anything online or in the preferences. Shift + comma and shift + period is acceptable workaround solutions, but they are not ideal, because I have the comma and period mapped to buttons on the Cintiq. I need them to wrap!

    4 digital brush thickness: is there a way to specify a thickness of brush with a number? I have to use the pen to get the STROKE thickness properties? At the very least, can I use a keyboard shortcut to specify the size, rather than click on toolbars?

    Honestly, I'm at the end of my rope here. I'm almost ready to completely abandon the Flash this in Illustrator, and then animate in Flash, so I've drawn everything correctly. Why everything is so different, and why I can't find one of these simple questions online?

    Him long and short of it is no you can't do most of the things you want to do as much as the brush is concerned. Flash has ALWAYS increased the size of the brush as you approach and it decreases when zooming. Why? No idea, but it has always been so.  You CAN increase the size of the brush in numbers but using the properties box. The Eraser is weird in Flash. so I use the Lasso tool and select what I don't want and delete it. Given that you're used to Illustrator you might not realize that selection of a brush stroke areas will NOT select the entire race as in Illustrator. You can only select parts. You can also sort of allow for what you call enveloping chronology by installing a command and by mapping to a custom key command. Make sure that there is a keyframe at the end of the cycle.

    Dropbox - Flash_Select_Next_and_Previous_Keyframes.zip

    Also, this could sort through what you want too:

    http://www.toonmonkey.com/frameJumper.fla

    Finally, Flash is no different that there has never been and it must be considered that, while the Illustrator has been developed by Adobe, Flash was developed by Macromedia and was then bought by Adobe years later then you "cannot really be expected to operate the same. Personally, I HATE the interface of Illustrator and hate the way it works if I hate it if Flash worked as an Illustrator!

    In any case, I hope this helps.

  • How to increase code efficiency in a while loop (using PXI5105 for sampling outside signal digitalizer)

    Theoretically, we want the PXI-5105 (digitizer) have 302 record with each record has a 1260 sample (the save operation is inside a while loop) in approximately 30ms, however we have found that for each period (30ms), the PXI5105 only perform about 10 records. It is so wired. I wonder if the operations inside the while loop consume more time (for example 3MS), so that he cannot have 302 records even the PXI-5105 have 60 M/s speed of sampling. Is it true, you can find my labview code and if possible can you give me some suggestion in the most short time of operation of the loop.

    Please find attached labview code.

    Hi g_l_g_s,

    The digitizer PXI-5105 acquires data at the speed that you specify and stores the data in its memory embedded (up to 512 MB). The data is then sent to your computer when the Multi Fetch Cluster.vi is called. In VI that you posted, you are only fetch record during each while the loop iteration. If you want to retrieve 302 records you will need to specify 302 files in the horizontal Timing.vi to configure. For more information about scanners, you might find the DevZone, hereuseful.

    To determine the amount of time it takes for each while the loop iteration, you can consider using the structure of code in the example comparison community calendar, which is located here.

  • What is READ the array returned by the DAQmx meter? How can I know the two functions DAQmx READ data stream in the same WHILE loop?

    I have a question about the order of execution.  In the WHILE loop, I have two things to measure, period and tension using the DAQmx READ functions for voltage and the meter.  In the end, I want to collect these data as points almost simultaneously as possible, as a pair and then send them together to another piece of code (not shown here) which them will result in some sort of command for an engine.  It would be run, and then I want to perceive the tension and the period at a time later and do the same thing.

    (1.) I'm a little confused on what the meter of the READ function is back because it's a table.  What is a picture of?  I thought that it was up to the value of the individual periods between rising edges.  The output of the counter 1 DBL d's a table. How many elements in this table, and what determines the size of this table?  Are the elements of the array the individual delays between the edges?  How many values are stored in the array by executing?   We take the AVERAGE of the last 15 items, but do not know if we are throwing some of the data or what.  How to understand the composition of this painting?  How can I change the composition of this painting?  Is it possible to measure only one period at a time, for example the time between TWO edges?

    2.) Will this WHILE loop execute as it gathers tension and a "period table ' (remains to be understood by me) by TIME running in a loop?  In particular, we want that the value of the tension associated with the value of the AVERAGE of the period "array", so we can use two data items to create orders of next control every time that the two values are reported.  The structure for the delivery of vi will be attached data in pairs like this?  I understand that one of the READING functions run not before the other function of READING in the WHILE loop.  I want that the period "means" and "strain (Volt) collected at the same pace. This vi will he?

    Thank you

    Dave

    Hi David,

    I suggest including the DAQmx Start Task function. If it does not start before the loop, it starts the loop and work very well, but it is not as fast and efficient. In the model of task status, task wiill go to run the checked each iteration of the loop and then back the time checked running when it restarts.

    The status of the task model: http://zone.ni.com/reference/en-XX/help/370466V-01/mxcncpts/taskstatemodel/

    Kind regards

    Jason D

    Technical sales engineer

    National Instruments

Maybe you are looking for