from loop with delay

Hello

A simple question. Is there a way to start a while loop after 2 seconds?

Thank you.

Here's what I mean

Tags: NI Software

Similar Questions

  • 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 can I create a loop with delays in the series?

    Hi all

    So I wrote a Labview program to control both machines. Very simply, one is a source of tension, and the other is a Lock-In amplifier. What I want to do is change the applied voltage, wait a few seconds for the response of GARLIC to settle, then take a number of measures of GARLIC, then those on average and save to file.

    Here is a flowchart of what I mean:

    I did it for the most part, but I'm having a little trouble with the delay. VI file is huge, so I tried to make a simplified architecture that shows the basics of what I do:

    (The string and the constant matrix constants aren't actually what I use, it's just to illustrate, because I don't know how to make a quick easy space reserved for diagrams... is there an easy way?)

    So my assumption here (and it seems that it is happening) is that, for each iteration more outside of the loop, the first thing it does is start the countdown and start the change applied voltage/etc. at the same TIME, right?

    And then he only goes in the loop of measure LIA once she completed both of these tasks, right? (Please correct me if I'm wrong!)

    Then, how would make a delay after the loop of measure LIA? If what I've said so far is correct, then if I put a 'waiting' in the main loop, I don't think that it works (or at least not be very specific) because he would begin as soon as the iteration, would therefore be cash while GARLIC measured, and so do not wait the right amount of time after the loop LIA was finished (if I even put that it is long enough that it was still underway after This loop was completed).

    Am I correct in what I said?

    What is the smart way to do this?

    Thank you!

    You're right about the order data flow, which is usually the fall of most starting LabVIEW developers.

    To add a wait behind the inside loop, ask a node pending within a structure (the simplest being a structure flat sequence) and add some sort of data flow from the output of this loop to the structure of waiting. This will force this structure will not work until the loop ends.

    That being said, there is a better way to do this. Look in the Simple State Machine with LabVIEW 2012 and more recent architecture model.

    Edit: NIquist beat me to it.

  • A problem with delays in call loops and DAQ

    I'm programming a simulation for nuclear Rewetting for a reception centre to my company in Switzerland. It is a "fuel rods" heating and then fill the water Chamber. The pump starts automatically as soon as the core of the stem reached 750 C. After that, a requirement that the flow rate be checked to ensure the operation of the pump in the necessary conditions. If not, the heating must be stopped to avoid, well... meltdown. However, we must allow 10 seconds for the pump to respond, while allowing a rate of acquisition of data from 10 to 100 Hz.

    The challenge is that I can not add a delay in my other main loop delay all acquisitions, but I can't understand how to trigger a device loop (with data acquisition for the single channel flow control) and the main loop when the loop device determines if the flow a initalised, answering the main loop with the agreement.

    I think that a large part of my confusion is in the interaction between loops and knots of default comments labview's willy nilly. The only solution would be to have two 'core' loops that do not communicate with them, but rather to do the same thing while operating different synchronization? Tell me if you want I will post the file (even if its on a unnetworked computer and I don't think that it would also be useful).

    Thank you + Curran

    Here is a version 9.0.

  • Deterministic loop is delayed when rewriting continuously buffer of the OD

    Hi all!

    I use the RT for neurofeedback: analyze brain activity and then give hearing feedback from the user in this regard.
    My RT goal is a desktop pc and I use the structure of typical loop of deterministic + not deterministic.

    What I want is a continuous output pure sound. The amplitude of the signal is calculated in real time and is based on certain characteristics of the brain activity of the user. It should vary smoothly to avoid artifacts of type click.

    Since there is no sound screws in the RT module, I use DAQmx writing VI (analog output) with active regeneration. The sample mode is continuous.

    Before the first iteration, I generate a sine wave to an appropriate length (a few hundred samples) and amplitude 1. Then, at each iteration, I calculate the new value of the amplitude and multiply the sine wave with a linear ramp so that I get a smooth amplitude modulation. On the same iteration, I write this new piece of data with the writing DAQmx VI.

    With this approach my timed loop gets delayed periodically, even thought that the cpu load is less than 20%. Rewriting constantly buffer of the device seems to be the problem.

    Is there a smarter way to do what I want? For example: can I write the pure tone only at the beginning and then control the amplitude setting a gain? I saw that there is a property of gain ( http://zone.ni.com/reference/en-XX/help/370469AA-01/daqmxprop/attr118/ ) but I can't seem to find it. I'm using LV 9.

    I'll be very grateful for any ideas!

    Thank you!


  • WE set with delay

    Hi guys,.

    I am new to LabView, programming as well. What I need is to control with LabView Arduino microcontroller and is nessessery for my diploma. I tried the solution of my problem here in the forum and all over the web, but I'm a bit confused of all this.

    What I do is when it comes to the TRUE value of the sensor, it sets ON an output pin for a deadline (in ms) and after time is managed by, he sets OFF again. I tried with the elapsed time in While loop, but when he doesn't loop with the time running in the main code loop (all looping in while loop)-> main code signs stops until the loop with the passage of time runs out. It's nessessery for me run the main code all the time without delays stop. IM little in blue, so...

    Help, please.

    Thank you very much.. Hanes


  • For loops with the cursor line and indexing

    Hi all

    I have a question about the loops with the cursor, line and indexing.

    How can I scan via a cursor with an iterator?

    I would use an iterator as

    Whole LoopIndex;
    Whole LoopIndex2;

    for LoopIndex at the beginning of the cursor at the end of the cursor
    loop
    line =: cursor [LoopIndex];
    for LoopIndex2 of LoopIndex at the end of the cursor
    etc...
    end loop;

    I need to use an iterator because I need to use a nested for loop.



    OR


    How can I solve the following problem?

    Class name % ofClass average test Score
    1 Niobe 7 8 8.4
    1 alena 4 7 7.5
    1 9 7 8.9 Estia
    1 Lilly 10 8 9.8
    1 Sandra 6 8 8.3
    1 Melanie 8 8 8.1
    Nadia 2 8 3 4.4
    Sayuki 2 9 8 8.4
    Diasy 2 7 8 8.0
    Flower 2 7 8 6.5
    Diana 2 6 8 7.3
    3 Flora 7 8 5.8
    Sukiya 3 4 8 8.4
    Samantha 3 10 8 7.7
    Roxanne 3 7 8 6.9
    Eline 3 8 8 7.4

    I need to
    -By class, I need to recalculate each average people
    -By class, I need to calculate the % of class score (sum averages / people in the class)

    So it can be done in a nested for loop?
    Or do I just step by step?

    Well, based on this information it would be something like...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as Class, 'Niobe' as Nm, 7 as Score, 8 as Tests, 8.4 as Average from dual union all
      2             select 1, 'Alena', 4, 7, 7.5 from dual union all
      3             select 1, 'Estia', 9, 7, 8.9 from dual union all
      4             select 1, 'Lilly', 10, 8, 9.8 from dual union all
      5             select 1, 'Sandra', 6, 8, 8.3 from dual union all
      6             select 1, 'Melanie', 8, 8, 8.1 from dual union all
      7             select 2, 'Nadia', 3, 8, 4.4 from dual union all
      8             select 2, 'Sayuki', 9, 8, 8.4 from dual union all
      9             select 2, 'Diasy', 7, 8, 8.0 from dual union all
     10             select 2, 'Blossom', 7, 8, 6.5 from dual union all
     11             select 2, 'Diana', 6, 8, 7.3 from dual union all
     12             select 3, 'Flora', 7, 8, 5.8 from dual union all
     13             select 3, 'Sukiya', 4, 8, 8.4 from dual union all
     14             select 3, 'Samantha', 10, 8, 7.7 from dual union all
     15             select 3, 'Roxanne', 7, 8, 6.9 from dual union all
     16             select 3, 'Eline', 8, 8, 7.4 from dual)
     17  --
     18  -- END OF TEST DATA
     19  --
     20  select class, nm as "NAME", score, tests, average
     21        ,round(((average*tests)+score)/(tests+1),1) as avg_person
     22        ,round((average / sum(average) over (partition by class))*100,1) as class_average
     23  from t
     24* order by class, nm
    SQL> /
    
         CLASS NAME          SCORE      TESTS    AVERAGE AVG_PERSON CLASS_AVERAGE
    ---------- -------- ---------- ---------- ---------- ---------- -------------
             1 Alena             4          7        7.5        7.1          14.7
             1 Estia             9          7        8.9        8.9          17.5
             1 Lilly            10          8        9.8        9.8          19.2
             1 Melanie           8          8        8.1        8.1          15.9
             1 Niobe             7          8        8.4        8.2          16.5
             1 Sandra            6          8        8.3          8          16.3
             2 Blossom           7          8        6.5        6.6          18.8
             2 Diana             6          8        7.3        7.2          21.1
             2 Diasy             7          8          8        7.9          23.1
             2 Nadia             3          8        4.4        4.2          12.7
             2 Sayuki            9          8        8.4        8.5          24.3
             3 Eline             8          8        7.4        7.5          20.4
             3 Flora             7          8        5.8        5.9            16
             3 Roxanne           7          8        6.9        6.9          19.1
             3 Samantha         10          8        7.7          8          21.3
             3 Sukiya            4          8        8.4        7.9          23.2
    
    16 rows selected.
    
  • Got a 27 "monitor from Apple, with thunderbolt (error). My MacPro can't love at first sight. Apple won't bring back the monitor. Will using a USB 3 map and then using a hard drive with USB 3 and Thunderbolt works?

    Got a 27 "monitor from Apple, with thunderbolt (error). My MacPro can't love at first sight. Apple won't bring back the monitor. Will using a USB 3 map and then using a hard drive with USB 3 and Thunderbolt works?

    N ° you need a computer logic board which has built in Thunderbolt.

  • I downloaded Multi Access Tool from Mcafee with Firefox Mozilla, how do I reinstall if it does not work properly?

    I downloaded Multi Access Tool from Mcafee with Firefox Mozilla, how do I reinstall if it does not work properly?

    My sincere apologies, my Mcafee came via the Optimum/Cablevision, not Mozilla. I now managed to solve my problem and appreciate the 2 above responses. Thank you.

  • Since Fx32, show Cookies always reveals no. stored COOKIES. Where are they? I have 'accept cookies from visited' with a large list of exceptions of blocked sites.

    I have "Always deprived of the use of navigation" and "Accept the Cookies from Sites" with "Third Party Cookies: to visit ' but with a long list of site Exceptions, I intend to block." Since Fx32, DISPLAY COOKIES still says there is nothing to show. I understand the incognito automatically deletes history (including cookies) on Fx is closed, but after some extensive navigation, I expect to see some session cookies only from sites that is: a) are listed ALLOW/SESSION on my Exceptions list; or (b) are not exceptions listed at all. The list of exceptions has two categories: Ad Server sites I block to avoid hearing; and ALLOW the sites I visit have warn me to allow their cookies. Even after the connection to these sites (connection requires their cookie) DISPLAY COOKIES always says that there is not.

    1 I'm wrong about PRIVATE BROWSING, it does not control the placement of the cookie, which leaves to ACCEPT the COOKIES and the parameters of the Exception, but erases them cookies and another story when Fx closes?
    2. so where's my cookies I know work when I login, for example, my mail server or Amazon?
    3-do I need to install the addon from SQLite-Manager to see the cookies .sql file? It will work with Fx32 +?

    Thanks for the input, cor - el. Once I realized where is the console command line and exceeded his SPAM warning, cookie.split () / join () worked very well: a lot of output, especially warnings of javascript and HTTP requests, at least a cookie. But then I wondered:

    I pressed accidentally on [CLEAR] and console obeyed, of course. So I enter again the command (several times) but now get no reply - msg just empty console pane. Close the current tab from fx, then open a new web console, connect and I reinterpret the split () / join (). Now console only statements interprets this command error msg: > undefined (attached screenshot).

    So my question: can this js command split () / join () consider only once? I have to adjust something first? It seems the PRIVATE BROWSING feature design "drape" of all the cookies I allowed to-I assume to keep them from being seen, that's it? So can a Web page script place a cookie, and then later in the same session back or questioning? A page can simply include a document.cookie.split()/join () command in the script?

    In any case, I'm happy to have your technique and grateful. Thank you. I'll try it as a bookmark shortly.

  • Can I use the old bluetooth keyboard from Apple with the new iPad from Apple pro?

    Can I use my old bluetooth keyboard from Apple with the new iPad from Apple pro?

    When I asked the same question on the Apple Store, they said yes. You need to try to be sure.

  • I can't find the bookmarks organize and/or export bookmarks from Safari with Firefox 4

    I can't find the bookmarks organize and/or export bookmarks from Safari with Firefox 4. View that all bookmarks does not help.

    Among the small icons - rightmost - in "show all bookmarks" is an import-export. Place your cursor on them and it will say what it is.

  • How can I export images from Photos with Lightroom or Photoshop?

    How can I export images from Photos with Lightroom or Photoshop?

    Use the file ➙ export Original unmodified for Photos X menu option.

  • several loops with error handling and controll

    I have a project where I spin 4 loops at the same time and must stop all the loops with a stop button as well as all the loops if one of the loops will receive an error.

    Loop 1.

    Loop start

    control the other 3 loops

    Loop 2.

    Analog voltage reading

    Loop 3.

    Digital inputs to read

    Loop 4.

    Write digital output

    Someone knows how to do this?

    Two other methods not mentioned in the otherwise excellent document that mentioned Matt are the use of a global variable 'stop all' and a relative using a Global Variable of VIG/functional.  The reason to talk about, is that they can be used also stop 'detached' live, live which are defined to run asynchronously (and therefore a bit 'out of control') regarding the main VI.

    I use a "combination of ingredients" for some projects I'm developing using LabVIEW 2016 and its support of the channels.  For example, I use a Messenger channel to create something akin to a message in queue manager.  When the event loop detects that the exit button has been pushed back, it puts a Message "Exit" on the channel of Messenger and stops himself.  When the Message Loop sees "Exit", it sends one release Message who else has need to see (in one case, the producer of a producer/consumer model) and stops himself.  When the producer Gets the output Message, it puts a "last element is invalid" on the flow of the channel for consumers and stops himself.  When the consumer gets the message of the last element, he stops himself.  A magnificent waterfall.

    And I work (not yet 100% complete) how to extend this to start the asynchronous calls that do not (yet) support channels as easily...

    Bob Schor

  • Treatment in time loop with microseconds.

    Hello

    I am make only one application in Labview where I capture the image of a camera and image processing. The camera is communicate with the Board of Directors NI PCIe-1433 in the PC with the camera link. This device can operate with a rate of 2000 frames per second. For the treatment of each image in the pc I need a time loop that work with microseconds. The problem is that this time loop only works with MS Windows. If I use the real time module, can I configure this time looping with microsecond or is there another solution?

    Thank you

    Hi xisco,.

    with LabVIEW Realtime, you could create a loop with the order of a microsecond wait States.

    BUT:

    Why do you think you have need of these wait States? What is the purpose of these expectations?

Maybe you are looking for