using while loops within while loops? 
Author Message
 using while loops within while loops?

Hi, within my program i developed i have many while loops within while
loops. the reason for this is that i needs the loops to be independent
of each other for using different rates of data collection, controling
external switches by relays etc. My problem is that the longer my
program runs for the harder it is for it to stop, even inserting a
application stop or exit does'nt help. It just tends to stop
responding and the only reliable way i can stop the program is to use
the close. Any insights greatly appreciated.


Fri, 01 Jul 2005 17:45:55 GMT  
 using while loops within while loops?
1) How can while loops that are stacked one inside the other be
independent of each other? An example (vi) of what you mean would be

2) A loop, that does not have an outside reason to suspend (like
waiting for an I/O interrupt) will cycle very quickly, consuming all
the power of the CPU. It is wise to have a "wait(ms)" call, even with
1 ms as argument it helps sometimes a lot.

3) Even if you have loops in parallel (where they would be truely
independent) it will be neccessary to have a common STOP button or-ed
together with the other terminating criteria to have a central control
to stop.


Fri, 01 Jul 2005 19:05:08 GMT  
 using while loops within while loops?
Hi. I don't understand why you want to put many while loops in a
single while loop. It makes more sense to me if you put all those
while loops with a common stop in a sequence instead. As long as the
loops are still running, the system will stay in that sequence.
Or if an outside while loop is really required, which I doubt, put
more delay on it.  Hope this helps.


Fri, 01 Jul 2005 22:03:23 GMT  
 using while loops within while loops?
Hi, yes i mean loops in parallel. Could not remember the name for it.
the reason i using so many while loops is that i use field point. The
field point is a point to point device, so can not be streamed as in
daqs. And when i control the field point modules i need each of them
to respond in a different way e.g. slightly different sample rates
etc. so i use parallel loops to make the devices independent of each


Fri, 01 Jul 2005 22:46:29 GMT  
 using while loops within while loops?
Hi Stuart
I read again your question.
Do you mean that the longer your program is running, the more time it
takes to stop the execution once you hit a "stop button" that effects
your while continuation ?
If you really have such a central "button" it might be a problem with
memory. D you have a way to monitor the memory usage, like with the
Windows task manager ?

If you have a problem with memory, check what is going into your
loops. labview has sometimes not very obvious  ways to create local
variables or references, that are not automatically destroyed.

Again a sample vi would help. It's just that I have only  LV 6.0.


Fri, 01 Jul 2005 23:29:56 GMT  
 using while loops within while loops?
Are you using memory over time?  You can check this on a 2000 or XP
machine in the task manager.  You might have a memory lead from
opening references repeatedly without closing them. This would explain
sluggish behavior over time.  You should also check to see if you are
building large arrays.  This will also slow your machine over time.

Sat, 02 Jul 2005 09:03:39 GMT  
 using while loops within while loops?
Hi, tried the task manager route and found that my program was using
98-100% cpu usage. I thought it may be the chart buffers in one of
while loops that could be causing this, as i have five. But i removed
them and still got the the same outcome. the thing i can not work out
i have a new developed on the same principles as the first, but this
program uses normally 2% of cpu usage. Any more comments u could
suggest to help me.

Thanks stuart

Sat, 02 Jul 2005 19:37:27 GMT  
 using while loops within while loops?
Thanks Gabi, it turned of to be a problem with the field point
software side.Nothing to do with the while loops.

Thanks Stuart

Sun, 03 Jul 2005 23:37:14 GMT  
 using while loops within while loops?
"Thanks Jeremy, it turned of to be a problem with the field point
software side.Nothing to do with the while loops.


Sun, 03 Jul 2005 23:38:58 GMT  
 [ 9 post ] 

 Relevant Pages 

1. 2 files: a loop within a loop??

2. Troubles using while loops and case loops

3. break one loop and skip one iteration of outer loop

4. Problem with loop inside other loop

5. Impelement for loop and do while loop

6. Fast loop inside a slow loop?

7. For Loop looping only once

8. nested while loops, inside loop not stopping correctly

9. For loop, possible to increment counter/exit loop?

10. changing the value of loop-control variable in loop

11. Loop variable value after loop finish

12. assigning to do loop control variables inside the loop


Powered by phpBB® Forum Software