LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop

Hi!
I'm in a serious trouble. I'm writing a VI that controls a temperature
stabiliser. Sometimes there's a need to break a for loop but I really can't
cope with that. Is it possible? Can anyone help me?

Thanks for all advice!

Ips McKornix
0 Kudos
Message 1 of 11
(3,951 Views)
Hi Ips,
you don't have to use "for loop",
for this way you have to use "while loop"
You can send me a part of you programm, and I try to replace for loop.
Best Regards
Mike



Ips McKornix wrote:

> Hi!
> I'm in a serious trouble. I'm writing a VI that controls a temperature
> stabiliser. Sometimes there's a need to break a for loop but I really can't
> cope with that. Is it possible? Can anyone help me?
>
> Thanks for all advice!
>
> Ips McKornix
0 Kudos
Message 2 of 11
(3,952 Views)
Ips McKornix wrote:

> Hi!
> I'm in a serious trouble. I'm writing a VI that controls a temperature
> stabiliser. Sometimes there's a need to break a for loop but I really can't
> cope with that. Is it possible? Can anyone help me?
>
> Thanks for all advice!
>
> Ips McKornix

Read a FAQ for this subject. It is known issue and described there in
details. Reference below:
http://www.icon-tech.com.au/thelabviewfaq.html
--
Sergey Krasnishov
____________________________________
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
http://acs.levsha.ru
0 Kudos
Message 3 of 11
(3,952 Views)
Hi1

Well, just an idea, but you could try to include a case in the loop, which
is linked to a stop button. If the stop-button is not pressed N is linked to
whatever your for-number is, in the case the stop-button is pressed, the
case would just link N to the iteration terminal and thus stop the loop!
I don't know, if that'll work, cause i'm not at my labview computer right
now, but it's just an idea i've got now.
Hope it helps!

regards,
Martin Klein
0 Kudos
Message 4 of 11
(3,952 Views)
you can not "break" a for loop. use a while loop instead with the logic to
terminate the while loop on iteration count or stop condition.
Stu
Ips McKornix wrote in message
news:952or4$3ii$1@info.cyf-kr.edu.pl...
> Hi!
> I'm in a serious trouble. I'm writing a VI that controls a temperature
> stabiliser. Sometimes there's a need to break a for loop but I really
can't
> cope with that. Is it possible? Can anyone help me?
>
> Thanks for all advice!
>
> Ips McKornix
>
>
0 Kudos
Message 5 of 11
(3,952 Views)
> I'm in a serious trouble. I'm writing a VI that controls a temperature
> stabiliser. Sometimes there's a need to break a for loop but I really can't
> cope with that. Is it possible? Can anyone help me?
>

If you pop up on the for loop, there is a Replace menu item.
In the menu, you can choose a while loop. This will change
the for to a while loop in one step. Now take the previous
value of N, wire it to the top of a > block. You now have
two Boolean cases where you want to stop. Combine them using
the necessary logic and your while loop works the same as a
for loop except it pays attention to the button, and as many
other exit conditions as you need it to.

Greg McKaskle
Message 6 of 11
(3,952 Views)
In article <952or4$3ii$1@info.cyf-kr.edu.pl>,
"Ips McKornix" wrote:
> Hi!
> I'm in a serious trouble. I'm writing a VI that controls a temperature
> stabiliser. Sometimes there's a need to break a for loop but I really can't
> cope with that. Is it possible? Can anyone help me?

Assuming you are using a FOR loop because the number of iterations are known,
you are probably advised to use a WHILE loop and have the loop boolean stop
the loop on a bad condition or loop iteration = some value. Generally
speaking, a WHILE loop is more useful than a FOR loop in LV.


Sent via Deja.com
http://www.deja.com/
0 Kudos
Message 7 of 11
(3,952 Views)
Thank you all for all your help but I cannot find the solution.
My problem is as follows :

I have to get the temperature from the stabiliser every given period of
time. I do it in this way : get the temperature and then I set a timer and
wait until the period of time passes. Then I do the next measurement and so
on. Meanwhile I may want to set the stabiliser to send the value of
temperature in Kelvins or centigrade. Unfortunately it's done only when the
timer completes its job. I have to interrupt the loop that makes the timer
go and send a request to the stabiliser. That's what I can't do.
DO you have any suggests? Any help will be appreciated.

Thanks

Ips McKornix
0 Kudos
Message 8 of 11
(3,936 Views)
Ips McKornix

Although you have had a few answers, the one I use is not in it (yet). A
solution I've used in the past is the following: You still can use the for
loop but when your situation occurs that you want to leave the loop you set
the time constant in your loop (pendule) on Zero. This can be done by using
the tool at which you can select a TRUE value and a FALSE value and just
wire the output to the pendule. On this way the whole FOR loop is run
through, but -if there are no other time delaying statements are in it- the
loop will finish the last cycles very fast. I used it for detecting a STOP
sign of the progrm and it goes very well, although it is not a very elegant
solution.

Regards,

Pieter Bosstad
0 Kudos
Message 9 of 11
(3,936 Views)
I don`t know if this is anything like what you`re looking for, but it`s most
likely how I would solve the problem (And have done in the past).

u can use occurrences to make the two different parts of the program
dependent on each other. Generate an ocurrence, wire it into the loop and
into the other part of the program you want to use. Set a case structure
within the loop to set the ocurrence upon the required condition. Set the
other part of your program within a sequence, with the first frame waiting
for the ocurrence. The code you want to execute after the ocurrence comes
in the second frame. Since the other part of the program is waiting for the
ocurrence (and the transmission of an ocurrence signal is independent of
dependency or loop status, i.
e. the ocurrence state can be transmitted
WITHOUT breaking the loop), this part will then execute once the condition
is met. After this, the loop will ocntinue to run (Or can be stopped if you
prefer).

Anyone else got an idea whether this is the best solution?

Shane O`Neill


Ips McKornix schrieb in Nachricht <9545gs$geb$1@info.cyf-kr.edu.pl>...
>Thank you all for all your help but I cannot find the solution.
>My problem is as follows :
>
>I have to get the temperature from the stabiliser every given period of
>time. I do it in this way : get the temperature and then I set a timer and
>wait until the period of time passes. Then I do the next measurement and so
>on. Meanwhile I may want to set the stabiliser to send the value of
>temperature in Kelvins or centigrade. Unfortunately it's done only when the
>timer completes its job. I have to interrupt the loop that makes the timer
>go and send a request to the stabiliser. That's what I can't do.
>DO you have any suggests? Any help wil
l be appreciated.
>
>Thanks
>
>Ips McKornix
>
>
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 10 of 11
(3,936 Views)