What happens to the while loop iteration counter if it runs unchecked?

I want to use the iteration counter to initialise a value on the first loop of a while statement. ie i = 0, x = 100. Fine. The application I am building will be left to run for weeks or months on end without stopping (hopefully :¬)). What happens to the iteration counter in this situation? Does it reset to 0 or what? I don't want it reinitialising any values while the loop is running other than when it starts.
I set up a while loop to try to figure out what happens and the iteration counter stops at 2147483648 which is 2^31 - 1.
Any help would be appreciated,
Thanks,
Niel.

It might be something you already looked at, but perhaps it's an option to perform the initialization outside (before) the while loop. That way it will be initialized correctly only once, no matter what the iteration counter does.
Of course if you need the counter for other purposes than initialization you might have the same problem...
Note that a lot of the timer functions also overflow after a certain time (I believe 24 or 48 days?) so be careful running very long loops (but you already knew that probably).

Similar Messages

  • How come my local variable is not updating it's value with respect to what's happening in the while loop?

    Hello,
    I am trying to extract data out of a while loop as my declarations update with respect to the iteration number. I have attempted to use both local variables and shift registers, but with no luck.
    I have also done the following example: http://www.ni.com/white-paper/7585/en and it works like a charm.
    I attached the PNG file with local variable declaration circled in red. Will attach a VI in the next respnose.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Local Variable.png ‏366 KB

    OK, looking at the code...
    Can you explain what it is supposed to do? What's the purpose of the value property node read which only seems to update an indicator.
    The inner while loop should proably be a FOR loop, because the number of iterations is known before the loop starts.
    Your use of formula nodes seems overly complicated.
    LabVIEW Champion . Do more with less code and in less time .

  • To count the number of while loops, do you just have to attach a DBL indicator to the little i box in the while loop of the program?

    I have just followed an example in a book to count while loops and was just want to make sure I havent missed something simple. My program is attached
    Solved!
    Go to Solution.
    Attachments:
    second attempt.vi ‏45 KB

    Hi Ssteel,
    Just some additional observations/tips on your code...
    1. I notice that you have a standard stop button going into a "run if true" stop condition of the while loop. In this cercumstance it is common to have the stop condition set as "stop if true". You can change this by right clicking the stop terminal and enabling the "stop if true" property. Obviously, it somewhat depends on your design preferences.
    2. If you have any issues with the application, perhaps you notice that it is taking over your processor resources, you should add some execution timing into the while loop. You will find the timing functions in the block diagrams functions palette (programming > timing). The Wait (or "wait until next ms") functions will provide your application with "down time", which means that the processor can execute other tasks.
    3. To elaborate what MikeS81 correctly stated, insert an incriment before the numeric indicator as shown below to get the actual number of cycles (i.e. the count terminal of the "while" and "for" loops are 0 indexed). Also note that I have changed the representation of the count to interger (blue). You do not need floating point precion when displaying the inciment count, at a while loop can only execute a "whole number" of times.
    I hope this has been useful to you Ssteel.
    Thanks for your post,
    Rich R
    Applications Engineer
    National Instruments UK & Ireland

  • How can I watch for an alarm, then wait to see what happens before the save?

    I have resurrected an old project, thus using outdated software (LV6.0.2)... any help is awesome.
    I am attempting to gather strain gage information on a piece of equipment. Ideally, when the strain gage level reaches a certain point, I would like to cause an alarm that alerts the user, gathers data for an additional xx seconds, then dumps all this information into a file. Thus saving the information leading up to the event, and the system response following.
    Though I haven't figured out how to preset the file name, (working on that), my current hurdle is figuring out how to get LV to continue saving data after the initial alarm. I can dump the information directly to a file, but its the continuation that stumps me.
    Any help is good help.
    Thanx,
    Paul

    >>If you don't mind, post a simplified version of your VI.
    Due to my extensive self-taught knowledge of LV, simplified versions are all I can currently create. At the moment, I am trying to gather concepts for later final assembly, as I am an electrical engineering student working at an internship where I am the only EE on staff. Final Assembly date is early Sept.
    How am I doing it?? Good question.. Still figuring that part out. Currently I acquire a sample of 83 points w/ rate at 5000. This was chosen as 1 complete cycle of 60Hz to remove unwanted noise. These 83 samples are put trough the 'mean' function, and scaled appropriately to allow accurate results from the 'Strain Conv' function, then processed to achieve accuracy in psi and sent to a chart for real time observations, and to a tunnel for indexing.
    I would like to add an alarm to indicate when the output hits xxxx (roughly 15000), acquire an additional 10 seconds of information, then save this to a file.
    Thus far I was planning on trying Sequence loops...
    Frame 1: use a 'sequence local' to get the initial data to later frames, where the alarm would stop the first while loop.
    Frame 2: continue sampling the data for xx seconds, send to another sequence local
    Frame 3: gather both locals together, build new array, save this to a file... Hopefully with a time/date like stamp as a file name to allow it to run un-monitored for an extended period of time.
    As this is a new venture, I have thus far not attempted frames 2 & 3 yet, working on that. I am guessing that the tick count you are referring to in your suggestion is from the iteration counter ('i' in a blue box), inside the while loop. I will work on that.
    I also recently contacted CC for assistance creating a time/date stamp for the file name... do you think this could work? (didn't ask this specifically) and I still haven't figured out how to create a file path from this. (granted the whole file path thing is a mystery in general)
    Plus.... when events happen, all data from the beginning of the aquisition run is saved, the longer the run, the longer the file. Is there a way to limit this to say.... the last 3000 samples? I think it would have something to do with creating an array xx long to start, then filling it, when the array is full the next point in the top will kick the last one out the bottom. (i think)
    I have attached one of the most recent versions of my attempts, hopefully you can open it. Please note I am using LV6.0.2
    Thank you sooo much for your help, (this is meant for EVERYONE). I feel lost. Everyone's direction and responses in all areas has been invaluable. Though I wish more would post in neutral formats, as there are many vi's I would like to glance at that I cannot due to version gaps.
    Attachments:
    stress test (wavveform capture).vi ‏48 KB

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • Can we place Analog in Read(AI-RE​AD) Vi inside the while loop for high sample rate like 22ks/s?

    I am using E-series Card for data acquisition.My requirement is to sample the channel, and check the 10 samples for certain condition.both at a time.What should be done can we place the AI-READ vi inside for or while loop for this purpose?

    Hello,
    Yes, you can include the AI Read.vi inside the while loop, you would just need to specify the number of scans to read for every iteration of the loop. Then, after AI Read.vi has read the data, you can do what ever kind of manipulation of the data you would like, before the next iteration of the loop. The one thing to watch out for is what ever manipulation of the data you do, be sure that it doesn't take to long whereas the buffer holding the data starts to back up. That can be checked by looking at the scan backlog output of the AI Read.vi, which will tell you how many scans have been acquired but haven't been read into your program.
    Hope this helps!
    Regards,
    Steven B.
    Applications Engineering, NI

  • The speed of the "for loop iteration"

    Hi all:
    I have written a short mini program just to test out the speed of a "for loop iteration"
    package generator;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2004</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
      private static long tmp = 0;
      public static int count=0;
      public synchronized long getValue(){
          long value = 0;
        value = 10 * System.currentTimeMillis();
        if(value == tmp){
          value++;
          count++;
        tmp = value;
        return value;
      public static void main(String[] args) {
       for (int i=0;i<1000;i++){
          getValue();
        System.out.println("count is " + count);
    }And i find that on average, count will be a value between 498-500, which probably means that on average the speed of a for loop is around 0.5 ms. But I guess the speed of the "for loop " iteration is also very much CPU dependent, could somebody possibly give me some education on this issue :) ?
    Also, anybody know exactly how System.currentTimeMillis works? For example, how does it get the current time from the OS, etc. let me know.
    Again, Many many thanks...

    Hi all:
    I have written a short mini program just to test out the speed of a "for loop iteration"You will find the overhead of the getValue() call, the increments and most importantly the System.currentTimeMillis() is what you are timing.
        public static void main(String args[])  {
            int ITER = 1000000000;
            long start = System.currentTimeMillis();
            for(int i=0;i<ITER;i++);
            long end = System.currentTimeMillis();
            System.out.println("Iterations per sec="+ITER*1000L/(end - start));
        }Prints the following Iterations per sec=576368876Running on a 1.8 GHz Intel/Windows2000

  • What happened to the old JamPack 1?

    Before the SteveNote, the four JamPacks Apple sold were:
    Jam Pack 1
    Jam Pack 2: Remix Tools
    Jam Pack 3: Rhythm Section
    Jam Pack 4: Symphony Orchestra
    Now, the four they sell are:
    Jam Pack 1: Remix Tools
    Jam Pack 2: Rhythm Section
    Jam Pack 3: Symphony Orchestra
    Jam Pack 4: World Music
    So what happened to the original JamPack 1? Have all of those loops and instruments been rolled up into GarageBand 3's default install, or are all those loops and instruments just plain discontinued?

    JamPack 1 is now included as a standard part of GB3.
    Where did you get this information from? Another poster recently said this:
    RockyRoad
    Posts: 14
    Registered: Feb 15, 2003
    Re: Jam Packs for Garage Band 3
    Posted: Jan 14, 2006 6:57 PM in response to: Logic Expert
    I think people are thinking it was included because its no longer listed as for sale at the Apple store.
    However it appears you are right. I did a clean install of Garageband 3 while my Jam Pack 1 folder was moved elsewhere and renamed, and the Garageband installer did not put any of those loops on my hard drive.
    For those wanting to check, the first loop listed in the Jam Pack 1 folder is "12 String Dream 01.aif" - so you can see if you have it anywhere.

  • What happens to the open item in bsid table when it is cleared

    hi experts,
                   i have a doubt about open and cleared items of accounting documents. as we know open items of customers are stored in bsid and cleared ones in bsad. For suupose, an open item is closed ina particular period then what happened to the entry in bsid and bsad table. an entry regarding is stored in bsad (cleared),and what happens to the entry in bsid, still it will be there or removed from it.

    Hi,
    When ever we clear the document(Complete payment) that document will be moved to BSAD table. Other wise it will remain in BSID.
    If u are making partial payment then all the partial payment documents along with original document will be stored in BSID till u made the complete payment for that invoice.
    Assumption is u have to give all partial payment documents made for particular invoice item while u are making complete payment in F-28 transaction. So that these partail payment documents will also be cleared while making complete payment and moved to BSAD table.
    This trasaction can be used for both partial and complete payments.
    Irrespective of complete or partial payments made all the documents will remain stored in BKPF and BSEG tables.
    BSID and BSAD are index tables to address performance issues with BKPF and BSEG tables.
    So all open and cleared documents will be there in BKPF and BSEG tables.
    All cleared documents will be there in BSAD table.
    Alll open documents will be there in BSID table.
    Hope it is clear.
    Thanks,
    Vinod.

  • Using a DAQ value in a location outside of the While Loop it is placed in

    I am writing a program that records the speed of a car and then is supposed repeat the action through the use of an actuator.  I was able to write the program to the point where I am saving the data into a .txt file and will be able to read it back out.  My problem is that I need to use a dbl value that I am calculating from the output of a DAQ Assistant block that is contained inside a while loop in another part of the program to compare current speed vs. recorded speed then output an action.  Everytime I try to draw a connection outside of the while loop, the actual value is not read outside of the loop.  I cannot put the other part of the program into the while loop because the while loop only performs every .1 to 1 second and I need the output to the actuator to be a continous string delievered to the serial port.  I also cannot create another DAQ Assistant block that reads the same port outside of the while loop.  I have thought about using a jumper to another input on the input card, but I would prefer not to use the extra space.
    So generally speaking, I'm wondering if there is a way to read a value obtained from a DAQ Assistant block outside of the while loop it is contained in.
    Thanks to anyone that can help!!!
    Travis

    Cheers,
    I am not 100% sure what your problem is but how about writing the red value into the local variable and reading it outside of the loop? Or enqueue the value into the queue and dequeue it in the other loop (Producer/Consumer Structure (Data))?
    Br,
    Jick

  • How do I store 4 hours of data and get it out of the "while loop" into a spreadshee​t file for documentin​g purposes? "See additional Text for additonal info"

    What a have is a VI that uses the following SUbvi's, starts with FP OpenVI, then FP Create TagVI, into a "While Loop" which contains a FP ReadVI outputting data into a Index ArrayVI outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File VI" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm self
    trained so have mercy.

    I figured it out thanks.
    John Morris
    Glendinning Marine

  • How do I store 4 hours of data and get them out of the "while loop" into a spreadsheet file for documenting purposes? "See additional Text for additonal info"

    What a have is a VI that uses the following SUbvi's, starts with FP OPENvi, then FP Create Tagvi, into a "While Loop" which contains a FP READvi outputting data into a INDEX ARRAYvi outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File vi" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm sel
    f trained so have mercy.

    I figured it out Thanks.
    John Morris
    Glendinning Marine

  • What happened to the "tuner" app? it's missing from itunes and apps store

    What happened to the "tuner" app? I bought it a few days ago, and now it's not available when my friend searches for it. I checked itunes, the iphone apps, and even searched by music catatory rather than by name.
    http://www.everythingicafe.com/forum/iphone-3g/tuner-app-mia-from-app-store-3223 0.html

    http://www.nullriver.com/
    When you click on the TUNER link, it launches the itunes store and says this app is not available in the U.S. huh? not fun! I have half a dozen friends that are excited to try it out. I'm glad I got it while I could too. I wonder what triggered the removal?

  • What Happened to the "Plus" Songs in the iTunes Store?

    I can't find any plus songs for purchase in the iTunes store. I used to be able to search for "+" songs, or browse for plus songs, but there are no links. Even searching for any song, browsing the songs, etc., show NO plus songs in the store.
    The only reference to "Plus", is to update some previous purchases to plus. I even tried searching for those songs and there are no results with a "+" next to them.
    What happened?
    Thanks

    A while back (sorry, can't remember exactly when... 2 years?), Apple stopped selling the non-plus versions of songs (128 kbps, DRM protected). They now only sell the "plus" version so there's no longer a need to make the distinction.

  • Changing up what happens at the 'select resource - queued' step

    Greetings!
    So, I'm curious .. we'd like to change how we do things regarding what happens at the select resource - queued step. Our current state is a series of business checks, place the call on hold, play CUCM MOH, take the call off hold, go back to the queue loop and repeat.
    To change things up I'd like to play some royalty-free music as a prompt instead of putting the call on hold. I would use boolean flags to keep track of what prompts have played so callers do not hear the same wav file over and over and over.  So, I'm thinking of doing something like this ...
    At the queued step ..
    play a prompt
    begin the queue loop
         business check
         agent check
         play royalty-free (RF) music clip 1 (45 sec)
         play informational prompt 1 (15 sec)
         opt-out check
    go back to the queue loop
    2nd time through ..
         business check
         agent check
         play RF 2 (45 sec)
         play info 2 (15 sec
         opt-out check
    3rd time ...
         business check
         agent check
         play RF 3 (45 sec)
         play info 3 (6 sec)
         opt-out check
    4th time ...
         business check
         agent check
         play RF 4 (45 sec)
         play info 4 (6 sec)
         opt-out check
    And maybe one more time playing these types of prompts before we switch to placing the call on hold and playing CUCM MOH. Generally, most calls are answered before the five minute mark, however, we do have outliers who wait a very long time. Playing CUCM MOH might be the appropriate thing to do for those rare instances?
    I'm curious if anyone else has tried this and am hoping for some feedback?
    Thanks!
    Keith

    Hi
    There's nothing wrong with doing it that way. I've seen a few customers play music from prompts rather than holding; it's easier to maintain/change that way.
    Aaron

Maybe you are looking for

  • Error in running custom tag

    Hi I am new in jsp?s custom tag development and trying to run it's example with jakarta-tomcat-4.1.30. I have hello.jsp <%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="first" %> <HTML> <HEAD> <TITLE>hELLO tAG</TITLE></HEAD> <BODY bgcolor="#ffffcc"><B>

  • Can't make static reference to method

    hi all, pls help me in the code i'm getting " can't make static reference to method....." kindly help me the following code gives the error: import java.rmi.*; import java.rmi.Naming; import java.rmi.RemoteException; import java.io.*; import java.io.

  • Realise n:m table structure

    Hello, i want to build up an editable n:m table structure with apex. can someone give me a hint, which is the best way to do it? I've worked myself through all tutorials and examples, but i can't find anything about this topic. Here is a description

  • Installing SAP 4.6B with existing database

    Good evenning. I need to install SAP 4.6B with existing database in SQL Server 2003. How can I do this installation?. Can you send me many guide? Best regards. Luis Gomez.

  • Opciones de Hotspot

    Me parece ridí**** que cada vez que apago el hotspot, quede encendido y tenga que apagar manualmente el bluetooh y la wifi, si estoy apagando el hotspot, es por que no voy a seguir utilizando ninguna función de esas. Me descargue ayer la actualizació