LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop and share variable

Hello!

 

I cant stop VI on stop control under while loop. I want when i run VI on stop button stop VI, stop reading share variable.

Can someone help me? sorry if my problem simple because i have started learning labview 2 weeks ago.

0 Kudos
Message 1 of 9
(4,409 Views)

You have nested loops. Which loop would you like to to stop? If one of For Loop-s inside Main While Loop, supply it with Conditional Terminal and place terminal of the stop button inside the loop.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 2 of 9
(4,400 Views)

i would like to stop the main loop when i started run VI! for loop stop when appear error.that's not problm..

0 Kudos
Message 3 of 9
(4,366 Views)

You don't make much sense. Please add a few more sentences to the problem description.

 

Also, please attach the VI, for example we need to know the mechanical action settings of the various buttons. Make sure the stop buttons are latch actions.

 

 

  • The inner main loop can only stop once the FOR loop completes.
  • The outermost loop (stop 2) cannot be stopped unless the inner main while loop stops.
  • The inner main while loop cannot start until the ini while loop completes.
  • There is a race condition in that "stop 2" gets read at program start, so if you press it during the inner loop, it won't get read until the next iteration of the outermost loop. Place the stop2 terminal in the inner loop (for example) so it gets read more often.
  • In the inner main while loop, the code of the two FOR loops can be combined into one FOR loop. 

 

0 Kudos
Message 4 of 9
(4,358 Views)

This VI is under construction and during  development program I have encountered some problems:

 

I would like when i open this VI run automatically VI, colleting value and display value on indicators. And during VI is running when i press Power off to stop collect value and close VI. I've attached VI and if if anyone knows to solve my problem I would be grateful to him.

 

  

Write your suggestions to improve VI.

 

p.s. sorry for my englishSmiley Wink:smileywink 😉


0 Kudos
Message 5 of 9
(4,349 Views)

You can set a VI property to cause it to run when opened.

 

You can also use a property node to close the front panel of your VI when done.

 

Check spelling "Retrieve".

 

Your multiple while loops are confusing.  What will cause your ini while loop to stop?  It looks like it will run forever until you get an error with your shared variables.

 

Your second inner while loop stops when you hit the Stop button.  Okay.  But your outer while loop starts everything all over again unless you've managed to hit the Stop2 button first.

0 Kudos
Message 6 of 9
(4,343 Views)

Your multiple while loops are confusing.  What will cause your ini while loop to stop?  It looks like it will run forever until you get an error with your shared variables.

 

yes, ini while loop will run forever until get an error  with shared variables. i must do this because if something go wrong with my PLC i will get an error and ini while loop stop.

 

i put main while loop to continuously collect values and i must put stop2 button. when i run VI i can't stop VI until i press abort execution.that's my  bigget problem.how can i stop my VI when i don't want to collect values and display on indicators?

 

this VI is designed that when i login and press button like windstation,pop up this VI and display on indicators real time values of my windstation.

0 Kudos
Message 7 of 9
(4,336 Views)

any suggest to solve problem?

0 Kudos
Message 8 of 9
(4,320 Views)

Sorry, you express the problem in a very unclear way.

 

This is your VI modified in the way that ALL loops are stopped by the same button. The changes are marked with red arrows. Please note mechanical action of the button!

 

Attention: This is not a good solution in any means! This is only an attempt to understand your problem and give you a hint.

 

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 9 of 9
(4,301 Views)