How to synchronize parallel while loops?
This will do what you want?
Tags: NI Software
Similar Questions
-
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 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?
-
2 parallel while loops with functional overall to share data
Hello
I'm having a problem with the sharing of functional with globals data between two parallel while loops:
- One of the loop (bottom) generates a random number periodically and write the total functional sample.
- Another loop (above) has a structure of event and when it expires, he would read the functional global and intrigue, a chart data point.
The problem is sometimes the functional overall seems to be 'locked' and the output becomes zero constant. It also seems that whenever I first open the VI, it works fine. But for the second time running, he begins to have the problem.
You must initialize your VI stop FGV FRONT of your lower loop begins. Even if you use a global variable that is functional, you have a race condition. FGV is read in the lower loop until it had a chance to be initialized with a value of false in the upper loop. Functional global variables do not forget their data between executions of the VI. So it is always set on stop the last time that you ran the VI. This works your VI the first time it's because VI does not have in memory, so when it loads, it loads with the default value False in the shift register.
-
Error with parallel while loops
Hello
I need to connect 6 different instruments gpib. I am using parallel loops, but the problem is when I try to open 2 or 3 Subvi simultaneously (the intstrument drivers), I just open one because of everything in a loop to run the Subvi. The program should be able to open all the Sub - VI independently.
Can give you some ideas?
Thank you
A. Castillo
Look at the detailed help for functions to notify. Then follow the links to the examples included with LV
Another problem that you have, whether you use your curls greedy or reporting or another technique, is to know how to stop your hand while loop. All the subVIs must be called before the loop stops. This is the fundamental paradigm of LV
You will probably need to rethink your primary architecture to something that will actually do what you want. Plan and design before your departure from the coding. Note requirements for the program and determine which parts are dependent on othrer parts, then select a program architecture that can meet the requirements.
Lynn
-
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 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.
-
Problem running two parallel while loops
Hello world
I'm new to Labview and is actually my first attempt. I intend to acquire data from two rockers simultaneously through two different ports. When I run my program attached with execution has highlighted, the second loop gets higher priority. How to prevent this? Also, I'm getting error codes when running arrives at the stage where Visa read data are passed to sweep of string function. Please suggest corrections to correct these problems.
PS: I have not yet plugged on devices, that's why the properties of connection for the two Ports are the same at the moment.
Kind regards
Avi0111
-
How to synchronize parallel VIs in labview 7.1
Hello
I want to synchronize two parallel screws. If someone knows what you can help me.
Aisha
-
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.
Maybe you are looking for
-
When opened in Xfinity e-mail, the text becomes so tiny u cannot read.
If I open my email account in the Explorer, the text is a good size and is readable. When I opened my e-mail via Firefox account, the text is so tiny that you can't read the headers or any other text on the page. The home page is fine to explore and
-
Re: Need driver for SM Bus for Satellite P305D-S8828
I just went down to XP Pro SP3 and the only driver I'm missing is the SM Bus controller. I think what I'm looking for are the drivers for the chipset AMD M780V, but I don't know I am unable to locate any drivers for this chipset, any help would be gr
-
Hello I need to install more RAM because it runs very slowly when I active antivirus. I've been Googling for days trying to find a definitive answer to this, but the closer, I could get was a lot of maybes: apparently as the computer's factory-made a
-
Smartphones blackBerry BIS registered with another provider of services
Users of the dear community, Does anyone have an answer on how to save its BIS e-mail when you have the answer "this BlackBerry is registered with a different service provider. "Please re-register this BlackBerry and check the URL matches the one pr
-
I can not open mail attachments
When Windows request "do you want to open the file", I said yes and chose Windows Picture Viewer - now that is selected automatically (and it doesn't), is it possible to change this to Adobe reader?