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

trigger event on First Call

I use one event structure and would like to trigger (one or more) event case when I first run the VI.

How can I do that correctly?

Thanks
0 项奖励
1 条消息(共 9 条)
4,297 次查看
Do you want to trigger a specific event or is it going to depend on how the vi is called?
0 项奖励
2 条消息(共 9 条)
4,292 次查看
It is a specific event.
0 项奖励
3 条消息(共 9 条)
4,292 次查看

A simple way is to include a value (signalling) property node and wire the error out terminal to the while loop wall (so it executes first).  Wire an initial value to the Value (signalling) property node and this should cause that event case to execute the first iteration of the while loop.  (kind of messy, but simple!)

 

Tom

4 条消息(共 9 条)
4,285 次查看
I usually make a hidden boolean and set its value(signalling) property outside of the main while loop of a VI. This will make the event case corresponding to the boolean value change the first thing to run in the VI. I've put in a suggestion to NI about giving us an initialize event, I'm not sure if it will happen though.
5 条消息(共 9 条)
4,284 次查看

I've had times where that would be useful (an initialize event case)!

 

Tom

0 项奖励
6 条消息(共 9 条)
4,280 次查看
Thanks for those ideas.

And yes, an Initialize Event is definitly needed!
0 项奖励
7 条消息(共 9 条)
4,275 次查看
Here's another common idea. Use your timeout case in the event structure as an initialization case. Do this by setting the timeout to zero for the first loop iteration and -1 on every subsequent iteration.

Message Edited by Jarrod S. on 03-13-2007 05:14 PM

Jarrod S.
National Instruments
8 条消息(共 9 条)
4,262 次查看

Very Good suggestion.  I will try that the next time I am in need. Thanks!

 

Tom

0 项奖励
9 条消息(共 9 条)
4,245 次查看