02-27-2009 09:28 AM - edited 02-27-2009 09:37 AM
Hello,
as mentioned before in another thread (http://forums.ni.com/ni/board/message?board.id=170&thread.id=390355), I have a main vi with a stop button and a sub vi, which needs some seconds to finish.
During the execution of the sub vi, I want the stop button of the main vi to take effect instantly, which means the sub vi should stop right away.
I know that I can exchange data between vis somehow with a call by reference, but all the examples I found, transfer data from the sub vi to the main vi, but I want it the other way round.
Since I have never used the call by reference, I have no idea how I can do that.
Attached you find, what I have done so far.
I would be very happy if you help me and show me how to use the call by reference correctly.
Johannes
LabVIEW 7.1 (I used to program with C and Labview 6)
Win XP
Johannes
Solved! Go to Solution.
02-27-2009 09:43 AM
Hi Johannesh,
I'm not sure whether you've any specific reason to use call by reference, but if not, I'd recommend using other method to exchange data between main and sub vi.
In this case, I believe global variable should be sufficient enough.
You may refer to http://zone.ni.com/devzone/cda/tut/p/id/7531 on how to use Global Variable.
Regards, Kate
02-27-2009 09:48 AM
Kate,
thank you very much for the quick response.
Yes, there is a specific reason to use call by reference. If the sub vi is executed, it takes some time to finish and the button in the main vi would take effect not before the sub vi is finished.
But since the button in the main vi is kind of a emergency stop button, it should stop the sub vi instantly. I cannot do this with global variables. right?
Johannes
02-27-2009 10:40 AM
I solved it!
A reference and a property node does it.
See attachment
Johannes
02-27-2009 10:53 AM
KateB wrote:Hi Johannesh,
I'm not sure whether you've any specific reason to use call by reference, but if not, I'd recommend using other method to exchange data between main and sub vi.
In this case, I believe global variable should be sufficient enough.
You may refer to http://zone.ni.com/devzone/cda/tut/p/id/7531 on how to use Global Variable.
Regards, Kate
Hi Kate,
Global variables can introduce Race Conditions that can be hard to locate and fix.
A better alternative is to use an Action Engine since they are not subject to race conditions when properly developed.
I wrote a Nugget on Action Engine ( that can be found here) to help others avoid the headaches that arise from Global variable use*.
Just trying to help,
Ben
* Please note that I did NOT call globals evil (this time).