05-27-2019 07:02 AM
Hello, I'm working on a projekt where I have 6 different loops running at the same time. I wish to have one stop button, to close them all.
I followed the guide on this link:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LmXSAU&l=da-DK
And I'm using local variables method to do it. It has been workI transfered it to my workgroup, it suddenly didn't work anymore. None of the loops we're running and you have to press the stop button twice, to even close it now.
Anyone know what happened? Maybe have a way to fix this? Thanks.
Solved! Go to Solution.
05-27-2019 07:16 AM
Not nearly enough information to make a diagnosis. What architectures are you using to the 6 loops? How are they all communicating? Sharing your code with us will help us help you.
05-27-2019 07:20 AM
They are running independently I guess? I've been trying to work with channel writer/reader, but not sure which kind to use.
Sorry I cannot share the code as it's a school final project.
05-27-2019 07:38 AM
05-27-2019 07:40 AM
@tubidubidoo wrote:
... I've been trying to work with channel writer/reader, but not sure which kind to use....
The info in the link you provided explains step by step how to do it, what kind to use and everything. Just follow the description.
05-27-2019 07:50 AM - edited 05-27-2019 07:51 AM
I fixed it by making 'tag' channel writer/readers, but I still had the problem with having to press it twice before stopping. I also fixed that afterwards, by making a sequence structure telling the value to be true, before sending a signal through the channel. Not sure why it worked, but it did?
Thanks for the replies and trying to help
05-27-2019 08:41 AM - edited 05-27-2019 08:41 AM
@tubidubidoo wrote:
... but I still had the problem with having to press it twice before stopping. I also fixed that afterwards, by making a sequence structure telling the value to be true, before sending a signal through the channel. Not sure why it worked, but it did?
A good programmer understands code! Fixing bad code by throwing even more bad code at it is not a viable solution. Most often things can be fixed by simplifying code! 😄
05-27-2019 10:07 AM
@tubidubidoo wrote:
I fixed it by making 'tag' channel writer/readers, but I still had the problem with having to press it twice before stopping. I also fixed that afterwards, by making a sequence structure telling the value to be true, before sending a signal through the channel. Not sure why it worked, but it did?
Thanks for the replies and trying to help
That sounds like you had a Race Condition which you worked around by forcing the execution order. There's probably better solutions to that problem.
/Y