取消
显示结果 
搜索替代 
您的意思是: 

ending time delay with stop button

已解决!
转到解答

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 项奖励
1 条消息(共 8 条)
6,873 次查看

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 项奖励
2 条消息(共 8 条)
6,867 次查看

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

Tim
GHSP
0 项奖励
3 条消息(共 8 条)
6,865 次查看

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 项奖励
4 条消息(共 8 条)
6,853 次查看
解答
已被主题作者 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 项奖励
5 条消息(共 8 条)
6,839 次查看

@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 项奖励
6 条消息(共 8 条)
6,816 次查看

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.

下载全部
7 条消息(共 8 条)
6,760 次查看

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

下载全部
0 项奖励
8 条消息(共 8 条)
5,476 次查看