LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Program runs out of things to do, but doesn't stop

I have a program that when it ends should stop after saving the data to excel spreadsheets, but for some reason the program doesn't stop despite nothing else going on. If I select highlight execution there are no animated executions going on. The program just sits there and I have to hit the stop hexagon to get the program to stop running. Any ideas?

0 Kudos
Message 1 of 11
(3,840 Views)

It would be useful if we could see the code.


Paul
0 Kudos
Message 2 of 11
(3,839 Views)

My crystal ball is out for a cleaning. Please post your code.

0 Kudos
Message 3 of 11
(3,836 Views)

Yeah, I'm gonna do that once I can get back to my computer. I'm in a meeting and I thought, "what better way to burn some time before I can go back to this aweful program I'm writing."

0 Kudos
Message 4 of 11
(3,824 Views)

I think it has something to do with the while loop on the bottom and having unexecuted parts of the while statement due to the event structure.

0 Kudos
Message 5 of 11
(3,817 Views)

Right.  The bottom loop will not stop until a Bicep program or Knee program value change event occurs and the Stop Value property is true.  Note that the Stop Value property is probably read as soon as the loop starts executing and will not be read again until the next iteration of the loop.  So for all practical purposes you likely will need two events after the Stop has been true to get the loop to stop.

 

Stop should probably generate an event and then send a Notification to the top loop.  I did not look closely at the program to see if that would work or if something more involved is required.

 

Lynn

0 Kudos
Message 6 of 11
(3,802 Views)

To elaborate on the event structure, the event structure will wait until some event happens before it finishes executing.  This is why it looks like nothing is happening.  At least one event must fire before the event structure is done.  To get around this, you can insert a Timeout event.  This will guarantee that the event structure will fire at least once, thereby enabling the program to finish its execution without any other events happening.

 

- tbob

Inventor of the WORM Global
Message 7 of 11
(3,796 Views)

I had a timeout event before, but the problem was then that I was having errors with building the path for the file I output to. I guess I could put those file in an if statement and if they are fed a true or false value will either go through the process of building a path or not.

0 Kudos
Message 8 of 11
(3,760 Views)

The Timeout event does not have to do anything.  It just ensures that the event structure will execute at least once, allowing you program to finish in case no other event happens.  This should not be related to your path problem.

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 11
(3,746 Views)

But because within the bicep and knee event values are fed from the ring menu to help build a path. If in the timeout there is no string fed to those wires to build a path the program throws an error.

0 Kudos
Message 10 of 11
(3,741 Views)