How they intend to while loops

IM an example to count the number of loops of my program did. However, it doesn't seem to work. Ive attached a DBL the i indicator in the while loop of the block diagram. I joined the program below.

Best regards, Sam

While the loop counter starts at zero, so if you want to know the numebr of iterations of the loop, you need to add 1 to the loop counter.

Your loop will work also only once, if the STOP button is not pressed, since you have time condifitional called loop terminal to to continue if true.  If you press the button before running the code, it won't work twice, because you have the Boolean value set to lock, so when the loop reads the Boolean value, it will return false and stop the loop.

I think that you want to change the conditional terminal back to interrupt if true.

Tags: NI Software

Similar Questions

  • How to have a while loop inside a structure of matter?

    Hi all

    I would like to know how to control a while loop by using the structure of the case? I would like the person to check if the object has is in its original position or not.

    If this is the case, go...

    The object must then do its job, as mentioned in the while loop... as up and down 10blocks...

    Later, when she returns to its original position, the entire process must stop...

    I checked the forums on this http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loops-inside-a-case-structure/m-p/591259

    It is the closest, I can have... but can someone tell me how to program for this? How logic should be?


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

    Hello;

    Sorry for my English

    I have to stop to a Subvi my main VI, the Subvi contains a while loop and an event structure, so I need to stop this loop while I tried directly from my main vi, global variable, but it did not work

    any help please or example!

    How about something like this (solution see attachment) using a user event.

    Explore the User Interface--> range of events and dialogue. To display the dynamic event of the terminals in the structure of the event just right click and select 'display the dynamic event posts '.

  • How to reset a while loop based on a value change event?

    Hi all

    I work in a labview program that sends voltage to a laptop via USB 6008, tension is amplified by an op-amp, and then he comes back in the laptop. I created a program and a working circuit, but my current challenge is how to reset the average of the values of voltage coming into the laptop, after that the user changes the digital control (which controls the output voltage). In other words, I need to be able to reset the number of iteration and the sum to 0 each time this happens.

    I looked upward to reset the counters of iteration through shift registers, but I'm not sure it will work in this case, but I'm also not sure how to reset the sum of an array (if possible). I have spent a lot of time to read these forums and tutorials from various sites, so I think it can be done with the correct nesting of the case structures, structures of the event and while loops, but I don't know how. I am new to LV, just started to learn in mid-January, so any help is appreciated.

    Thanks in advance,

    Graeme

    You just need the structure of single event with the bargains.  Use the case of timeout to get your new values and find the average (100ms timeout value and get rid of the wait function (ms)).  Keep the amount and the number of items in the shift registers.  Wire these values through each case of the event.  In the event of changing the value: control, just set the values to 0.  Then add a Stop button value change event to stop your program.

  • How to run a while loop for 0.5 seconds?

    Hello

    I am doing a project and I'm stuck with the programming.

    Some time ago in a loop inside a box structure. When the real state of a structure box is enabled, the loop inside, should run for 0.5 seconds. How do this?

    Thanks in advance.

    Why you want to run a while loop? what you do inside that? If you want to perform any operation for a specific time, you can use a loop for.

  • How to 'continue' a 'while' loop using an "if"?

    I have a loop 'while' continuous operation, by taking a step at each iteration. In each such iteration I save this measure unique to the file AND display it on a chart. From time to time, I have "out-of-range" measures, which are displayed as 1E-37 or 1E + 37 on the graph and poured on the record, and are not relevant (for me, it is). With the help of a simple interpreter, like python, I could use an 'if' statement to check if the reading is indeed irrelevant and if so, 'continue' in the loop 'while' so that it stops the current iteration and starts a new.

    How we not implements such a thing in LabVIEW?

    Thank you

    Amit

    Hi Amit,

    There was no 'cynicism', not at all! You ask a few notions of LabVIEW base so I suggested where to find that...

    "but this would require having wrap all code inside the"while"loop."

    OK, then you should explain the difference of a IF/THEN construct textual languages. Made a simple

    IF test

    {do something here}

    ON THE OTHER

    {do something here}

    not wrap the code inside a structure?

    A CASE structure does exactly the same thing and I don't see anything more simple as followed by comparison of two cases. What is complicated in a case around another structure design code?

  • How to run a while loop continuously without iterate loop inside the fi, a condition is met

    I enclose a VI that once the answer 28 comes the loop must stop and loop should continue an iteration. Can you show me a way for her

    You can stop the loop when a certain condition occurs: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/add_cond_to_for_loop/

    Add a register to offset for the while loop and to implement the feature as below:

  • How to stop the While loop in the Structure of the event with the same button?

    Hello

    I have a problem. I want to use a single control to activate an event in a structure of the event and the same control to end a while loop in this case.

    It is possible to use 2 controls to do this, but I need to be alone.

    Thank you

    You should NEVER place while loops inside the case of the event, and it is never necessary to do. Think about it: all you have to do is spin the code. You can easily use the outside while loop for everything. Simply place the code of the loop internal (without the inner loop) inside the case of delay and manipulate the time-out period between a pending finished and the infinite (-1), depending on the State of the Boolean value.

    A very simple example (LV 8.0)

  • How to end parallel while loops

    Hi, I'm using LV8.5.  I have 2 while loops, running in parallel.  Loop1 is faster (waiting time of 100 ms) and Loop2 is slower (several minutes waiting time).  I use a local variable (STOP button) Boolean to commonality between the loops.  The button is in the loop faster (Loop1) and the local variable is in Loop2.  When I try to end the While loop, Loop1 stops immediately, while I have to wait for Loop2 finish.  Is there a simple way to make two loops to stop immediately?  I have been using a Control\Stop Application, but may not be the right solution.

    Thank you.

    Hi shanx2,

    reduce waiting time in your second loop and count the iterations instead. The loop will do the same, but the stop will react much faster. Another possibility would be to use a queue instead. Connect to a timeout that corresponds to the current time-out period, you use and send a message to stop the loop. You can choose between the queue has been exceeded or not. Connect this result to the conditional loop. You can send the message from the queue after the first loop was arrested.

    Mike

  • How to synchronize parallel while loops?


    This will do what you want?

  • structure of the event + while loop

    Hello, I am trying to understand how to unite two while loops in attached VI for half a day

    The first loop creates a state machine solid which reacts on each key and runs one of the structure cases. (that part works very well)

    The second loop, always generates the random number, but it stops the generation during the time where one of the structure cases events are executed. (this is the part ticky)

    Any suggestions?

    If you want your random number to stop so that the user triggered events are running, you should be able to simplify your design a lot.

    It can be done with a loop using the case of timeout.

  • How to make a graphic inside a while loop to maintain the previous values

    At first I tried to use a the VI Express XY graphics to create a track of points.  However, the chart is a trace linear between the first point in the new line and the last point of the previous line.  It then creates the new line as you wish.

    I tried to use a loop with group a cluster for the chart, but the chart resets the plot at each iteration (as expected) and I can't find a way to maintain the previous data.  I tried using shift registers, but was unable to find a way to do it, and I tried also the cluster of a painting company, but can not find a way to make the cluster to a 1 d of a cluster of 2 elements array.

    One option is to have is to find a way to maintain the previous data, but the preferred option is to create a new path to each iteration to see the color change for each new parcel.

    I take stabbed it because I don't know exactly what you want. But I think that's what I've shown here. You must use a shift on your outside register while loop, as I showed. Your image where you tried to use a shift register shows a misunderstanding of the shift registers and how well they work, then I'd take a peek at these tutorials.

  • How I WRITE VISA to 2 devices of a while loop?

    Hello

    I have developed a fairly complex vi that reads data from two sensors and controls SERIES written to two engine controllers.  The idea is to send the engine controls more or less "simultaneously", and they are generally not the same commands.  The two motor controls are determined by the sensor input with each iteration of the WHILE loop and subsequently sent to the VISA WRITE motor controller.  I was getting an errors and failures with the vi, then, we decided to break up and test the components individually.  In the original vi, I had two sets of VISA OPEN, WRITE, NEAR wired inside the WHILE loop and he sent two orders for both engines successfully.

    The test code I have attached here, "simple VISA speed controller rev1.vi" has the VISA sequence configured around the loop according to the advice of OR.  He suggested that the VISA OPEN and CLOSE while loop and wiring outside the VISA two WRITE such as shown.  However, in this configuration, only the command of the CHANNEL 3 runs.  The CHAIN 1 command does not run.  The string ' / 1V...» "engine controls 1, and" / 3V... " "engine controls 3.  So, by changing the 1 and 3, I order two this vi engines, but only, the chain is the first VISA WRITE running effectively, regardless of the engine is selected in the order of the string.  There is no malfunction of the motor or wiring, and I order the two motors separately using the software provided with the manufacturer of the motor controller, therefore, the hardware has been confirmed to work properly.  I use NI USB-RS232 to send the string on the motors controllers.  Motor controllers are connected in Garland, and each has a switch address so 1 engine knows how to respond to ' / 1V...» «and the engine with the value '3' address switch responds to ' / 3V...» "etc.

    The other code attached here, "simple VISA speed controller 2 motors.vi" sends the two commands at the same time.

    So, why the second VISA WRITE does not work the '... rev1.vi '?

    Thank you

    Dave

    Hello Dave,

    In accordance with our telephone conversation, that give a try.

    Joel C

    National Instruments

    Engineering applications

  • 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

  • How the entry changes with each iteration of the while loop

    Hello

    can anyone explain (clarify) to know how or what contribution will be fed like the d block of adaptive filtering for the first, second entry (n) and remaining iterations of the while loop as shown in the picture as an attachment...

    As I need to feed the e (n) out of the while loop as input d (n) to the Adaptive block for the first iteration for the next iteration of the previous output e (n) of the block Adaptive must be fed back as input (n) d and other x (n) of entry form the DAQmx.

    Thank you.

    You have a shift register on the edge of the loop, so for the first iteration, the input (n) d will get everything that feeds the shift register on the left of the outside. After that the adaptive filtering performed, e (n) is injected in the shift to the right, register to be read from the shift register on the left on the next iteration. And so on. This seems pretty much what you want.

    PatanGova wrote:

    As I need to feed the e (n) out of the while loop as input d (n) to the Adaptive block for the first iteration for the next iteration of the previous output e (n) of the block Adaptive must be fed back as input (n) d and other x (n) of entry form the DAQmx.

    If you need retain the value in calls, use a node that is initialized in the world of feedback to feed out of the while loop at the entrance.

Maybe you are looking for

  • ITunes won't convert to mp3 since the update

    ITunes won't convert to mp3 more since the last update. Think Ive tried everything and was working fine before. IM on windows.

  • Disable Norton Antivirus

    Pavilion model g6-2269wm with Windows 8. I want to use Windows Defender and when I try to turn it on, it delivers a message on compatibility. Norton Security asks me to buy it and informed me that the software is up to date. I just want to stop the a

  • trying to enter user name on the Web site and it only accepts one digit at a time

    try to open a secure Web site and the user name only accepts one digit. It replaces the 2nd digit, then the 3rd, etc. How do I erase everything that makes that?

  • CHKDSK verifying indexes will not end

    When I start my computer, it says it needs check the drive for consistency. If I let him continue to get through files that controlled very well, but when he goes to a check of the index, it is about 12-15% and restarts the computer. I have read and

  • Can't print pdf documents

    New problem today. HP p1005 laser printer does not print a PDF file. Help! Michael OT:printing PDF