LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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 Kudos
Message 1 of 9
(4,121 Views)
Do you want to trigger a specific event or is it going to depend on how the vi is called?
0 Kudos
Message 2 of 9
(4,116 Views)
It is a specific event.
0 Kudos
Message 3 of 9
(4,116 Views)

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

Message 4 of 9
(4,109 Views)
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.
Message 5 of 9
(4,108 Views)

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

 

Tom

0 Kudos
Message 6 of 9
(4,104 Views)
Thanks for those ideas.

And yes, an Initialize Event is definitly needed!
0 Kudos
Message 7 of 9
(4,099 Views)
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
Message 8 of 9
(4,086 Views)

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

 

Tom

0 Kudos
Message 9 of 9
(4,069 Views)