LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error closing multiple loops with local vaiable

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 8
(261 Views)

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.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 8
(251 Views)

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. 

0 Kudos
Message 3 of 8
(248 Views)

There's apparently a bug in your code. Probably a race condition. I would recommend the channel wire way to do it.



Certified LabVIEW Architect

G# - Award winning reference based OOP for LV, for free! VIPM Github
0 Kudos
Message 4 of 8
(239 Views)

@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.

 



Certified LabVIEW Architect

G# - Award winning reference based OOP for LV, for free! VIPM Github
0 Kudos
Message 5 of 8
(236 Views)
Solution
Accepted by topic author tubidubidoo
05-27-2019 06:09 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

0 Kudos
Message 6 of 8
(231 Views)

@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! Smiley Very Happy


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 7 of 8
(204 Views)

@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

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(186 Views)