Jump to content

While loop


Recommended Posts

Hi,

I have a while loop in an other while loop. The inside have a button start over a loop tunnel. Now if I press this button the programm inside this loop should work and if I press the stop button I have linked to the loop inside this loop should stop.

Now, I only press the run button from LV. It steps into my big while loop. Then, without pressing the start button of the other loop the programm steps in the small while loop :wacko:

Why? The value of the button should be false without pressing.

And if I am in highlight modus I see a small f.

If I press the start button in this modus I see a t.

Here an image:

Link to post
Share on other sites
Hi,

I have a while loop in an other while loop. The inside have a button start over a loop tunnel. Now if I press this button the programm inside this loop should work and if I press the stop button I have linked to the loop inside this loop should stop.

Now, I only press the run button from LV. It steps into my big while loop. Then, without pressing the start button of the other loop the programm steps in the small while loop  :wacko:

Why? The value of the button should be false without pressing.

And if I am in highlight modus I see a small f.

If I press the start button in this modus I see a t.

Here an image:

1907[/snapback]

Hi Sarah

put your sub loops in case statements, control via front panel button/switch.

chow

xseadog

post-577-1095935671.gif?width=400

Link to post
Share on other sites
Hi Sarah

Are you sure the "INIT"step was execute?

1)Make sure the each while loop was exectue when you start the program.

2)Make sure the conditions(stop if true or continue it True) that you stop the while loop.

3)Make sure the butten Mechanical Active.

post-705-1095936909.jpg?width=400

Jimmy Chen

1913[/snapback]

Yes, the INIT is execute

1 it is

2 stop when true is active

3 the mechanical action is everytime like your example image

:headbang:

Link to post
Share on other sites
Yes, the INIT is execute

1 it is

2 stop when true is active

3 the mechanical action is everytime like your example image

:headbang:

1914[/snapback]

Hi Sarah

Noticed that in your image that you have a 'reset' ( top RHS)condition that will execute at some moment in time .

Could that be causing a problem :rolleyes:

Also on your 'NIT'case, that case it is not wired. Is this just due to cropping of image or actual in your VI???

Try enclosing reset condtion in a case statement for debug purposes.

chow

xseadog

Link to post
Share on other sites
Hi Sarah

Noticed that in your image that you have  a 'reset' ( top RHS)condition that will execute at some moment in  time . 

Could that be causing a problem :rolleyes:

Also on your 'NIT'case, that case  it is not wired. Is this just due to cropping of image or actual in your VI???

Try enclosing reset condtion in a case statement for debug purposes.

chow

xseadog

1916[/snapback]

Yes, but the reset is only working if the int is finished, after the reset case is activated and set some values blank.

The INIT case is wired, if not, the programm couldn't step into this case, I think. You can't see the connection on this cutting.

I replaced the while loops to case structures. But now I have the problem with the stop buttons :wacko:

Or is there a proberty where I can stop the case structure?

Link to post
Share on other sites
Yes, but the reset is only working if the int is finished, after the reset case is activated and set some values blank.

The INIT case is wired, if not, the programm couldn't step into this case, I think. You can't see the connection on this cutting.

I replaced the while loops to case structures. But now I have the problem with the stop buttons  :wacko:

Or is there a proberty where I can stop the case structure?

1917[/snapback]

Sarah

what I meant was to enclose the while loops in case statements !!

also try putting a wait pause with in loops so that CPU is not overloaded

ie set wait time to 20 mSec

chow xseadog

Link to post
Share on other sites
Now, I only press the run button from LV. It steps into my big while loop. Then, without pressing the start button of the other loop the programm steps in the small while loop  :wacko:

1907[/snapback]

Yes, this is normal.

There is a rule in LabVIEW execution flow. ALL loops must execute at least once before they stop. This is because LabVIEW MUST iterate in order to read the value of the boolean and then it will decide that it should stop the loop from running a second time. If you don't want to run the loops at all, you must use a case structure around the FOR loop set to false.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.