LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EXIT button for killing While Loops...

I have a front panel that has an "EXIT" button for the purpose of killing the two independent while loops running in the block diagram. But it does not seem to work. Could anyone offer me a way to do this?

0 Kudos
Message 1 of 20
(4,431 Views)

Do you have an example image of the block diagram?

0 Kudos
Message 2 of 20
(4,428 Views)

Here is the meat of it:

 

kill_two_for_loops.PNG

 

0 Kudos
Message 3 of 20
(4,422 Views)

Click File -> New.... (Not New VI).  Under the From Template category, there are some design patterns that have multiple loops.  (master/slave, producer/consumer).

aputman
0 Kudos
Message 4 of 20
(4,421 Views)

I do not think that is what I want though. I want indepent loops not driven buy some other loop that can be "killed" from a single "kill" button...

0 Kudos
Message 5 of 20
(4,412 Views)

What does debug say?

Does stop event happen?

What does it read in while loop?

Do you have false connected to shutdown after bottom loop?

0 Kudos
Message 6 of 20
(4,402 Views)

Error code -1074384860.

 

Anyways, I discovered that the application protocol in the CAN DBC file being used was not set to SAE J1939 as it should have bee.. This caused an error to propagate throughout the block diagram. I will retest again see what happens.

0 Kudos
Message 7 of 20
(4,386 Views)

@swbpnole wrote:

I do not think that is what I want though. I want indepent loops not driven buy some other loop that can be "killed" from a single "kill" button...


Then you misunderstood some very basic concept of dataflow programming. Maybe you should reconsider using NI LV.

That being said, it is always VERY BAD PRACTISE to 'kill' loops without running through proper cleanup routines inside the loop.

 

Passing "Shutdown" via queue to run through the Shutdown state of the slave/consumer (whatever name you choose) is the highly recommend way to do a shutdown.

When having multiple loops in parallel, a broadcast technology like notifier could be easier to use compared to queues; however, the concept still stays the same.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 20
(4,381 Views)

@swbpnole wrote:

I do not think that is what I want though. I want indepent loops not driven buy some other loop that can be "killed" from a single "kill" button...


Your loops don't appear to be independent to me.  You reference the same queue in both loops so I would assume data is flowing between them.    Why not use that queue structure to kill your loops, similar to the Producer/Consumer design pattern?  Since your queue is string based, you can send a "STOP" message when the button is pressed and use that message to kill the top loop.  

aputman
0 Kudos
Message 9 of 20
(4,379 Views)

The queues in image have CAN frames as their type.

0 Kudos
Message 10 of 20
(4,370 Views)