LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ending time delay with stop button

Solved!
Go to solution

I am trying to create a stop button to control multiple vi's at once. A problem is that my subvi has a time delay. To solve that problem the time delay is divided into multiple time delays so that I can interrupt it with a stop button.I am building off of Al S's example on the forums found here. I tried adding a global variable but it is not working. 

 

Any ideas? Thank you

 

 

0 Kudos
Message 1 of 8
(6,036 Views)

Greg McKaskle's idea in the last post of that thread seems a better way to do this.  Use the timeout of an occurrence (or similar labview feature with a timeout) as your timer, and set the occurrence if you want to stop early.

0 Kudos
Message 2 of 8
(6,030 Views)

What is your end product going to do? Why would you not leave all of the timing in the upper loop?

Tim
GHSP
0 Kudos
Message 3 of 8
(6,028 Views)

To drjdpowell, I really do not understand notifiers and occurrences. I have tried to read up on them, but I am confused. I wanted to understand global variables and how they work before I moved on to harder things. If you have any good documents to on the subject I would love to read them.

 

To aeastet, this is going to be part of a bigger application. All of the timing is not in upper loop because for my project I have a main vi and 3 levels of subvis that I am trying to stop at the same time. 

 

I am also trying to display the elapsed time on the top main vi which is why I like the example by Al S here

 

I have attached a block diagram of my project. The items that are circled in red are the vis that I have trying to stop at the same time.

 

I can attach my project in the future, but I was relunctant because it is 9 vi files. 

0 Kudos
Message 4 of 8
(6,016 Views)
Solution
Accepted by kkroninger

I highly recommend that you take some time and learn how to use notifiers. They are not that difficult to use and they are far superior to global variables. Dependence on local and global variables is a good way to find yourself running into race conditions in your code. Much better to use constructs (notifiers for example) that are intended to message other parts of your program.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(6,002 Views)

@kkroninger wrote:

To drjdpowell, I really do not understand notifiers and occurrences. I have tried to read up on them, but I am confused. I wanted to understand global variables and how they work before I moved on to harder things. If you have any good documents to on the subject I would love to read them.


Like Mark, I would suggest you are better off learning notifiers and in fact skipping ever using a global variable at all (otherwise you'll just end up having to learn not to use global variables).  But in this case, the details don't matter.   There are several functions in LabVIEW that allow a process to wait for an event to occur, and they all have a timeout option in case the event never occurs.  By using one of these functions as your "wait", you can end the wait early by calling whatever the event is from some other part of your program.  "Occurrences" are the simplest.  I don't have any documents, as learned most of my early LabVIEW through "Help>Find Examples...".

 

-- James

0 Kudos
Message 6 of 8
(5,979 Views)

I wanted to thank everyone for their incouragement to learn notifiers. So I finally did and notifier were the solution I was looking for. I found help from DianeS with her 1st post here and from WayneS1234 with their 1st post here

 

I am posting my code to show what I learned. I think it might help someone else. Note that this is like a block diagram with working notifiers of my larger project that I am working on.

Download All
Message 7 of 8
(5,923 Views)

Hello KKRONINGER,

 

With help from your code and this thread, I made a small utility VI for delay using notifier

 

Any suggestions or improvement is greatly appreciated

 

Regards,

Davidson D

Download All
0 Kudos
Message 8 of 8
(4,639 Views)