LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop won't stop when stop button is pressed

Solved!
Go to solution

Hi,

 

I have a program on LabVIEW which includes a number of loops but one of my loops (which surrounds a series of "TDMS Write" functions) has a boolean stop that passes a signal through two OR functions and into a loop control (please see aea of interest). My problem is that when I press the stop button the loop will not stop and so will continue to record and write data that I do not need to a file.

 

Could someone please help with this?

 

Regards,

Aaron Broady

0 Kudos
Message 1 of 18
(5,123 Views)

please share the code so that its easy to debug and provide solution in proper way else it will a guess which may not be accurate all the time

 

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 18
(5,113 Views)

This is the VI we are using, please find labelled the issue.

0 Kudos
Message 3 of 18
(5,111 Views)

Stephen,

You need to follow LabVIEW Gudeliness when you are building a Code which will help you and other developers to understand and Debug easily.

Code readability also will be good

 

Three Loops are running parallel and Stop control is outside of the  all the three loops, so even if you press Stop button it wont be triggered inside loop

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 18
(5,079 Views)

Its better to Reconstruct the code for future update if you need to work for now with the current code, Use Functional Global or Notifier to Transfter the Stop trigger to Loops in that case it terminate the loop based on the trigger signal

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 5 of 18
(5,073 Views)

How would we go about using the functional global in our code?

0 Kudos
Message 6 of 18
(5,068 Views)

Create a SubVI with Shift Register Holding the data (init, Write, Read), Handle the Event stop button in the separate loop  and Write True to the SubVI and in the other three loops try reading the subvi output and wire the output to loop Terminator 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 18
(5,060 Views)

Could you please attach an example code for how we would do this?

0 Kudos
Message 8 of 18
(5,057 Views)

Please re-structure your code with a proper design pattern and don't try to fix the issue and proceed. You might/will run into many issues just becuase of the improper coding style. Check this link for a presentation on design patterns, please use on of those,

-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 18
(5,050 Views)

We haven't had any other issues with this code apart from the one that is the reason for this post. This code has been used in operation and has given some good results so the design of the code is not the problem. We are currently in the process of changing the code slightly to fit the new needs that we have.

 

So please could we have an example of the section of code that has been recommended for the problem to be resolved?

 

Kind regards,

Aaron and Stephen

Message 10 of 18
(5,036 Views)