07-12-2016 04:41 AM
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
Solved! Go to Solution.
07-12-2016 04:49 AM
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
07-12-2016 04:49 AM
This is the VI we are using, please find labelled the issue.
07-12-2016 05:38 AM
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
07-12-2016 05:48 AM
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
07-12-2016 05:56 AM
How would we go about using the functional global in our code?
07-12-2016 06:06 AM
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
07-12-2016 06:07 AM
Could you please attach an example code for how we would do this?
07-12-2016 06:19 AM
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,
07-12-2016 07:04 AM
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