01-31-2002 10:00 AM
01-31-2002 11:37 AM
01-31-2002 12:13 PM
01-31-2002 06:21 PM
The examples submitted by other contributors work because the front panel of the second VI is opened. This condition is sufficient to keep second VI in memory when first VI stops and closes.
However, if the second VI would not have its panel opened, it would be aborted when first VI stops because LabVIEW releases a VI from memory when its panel is closed and no running VI has reference opened to it. That is why you have been told that second VI must open a reference to itself in order to stay in memory when first VI stops.
The problem you probably have is a race condition: first VI opens a reference to run second VI but it exits too soon, before second VI has time to open a reference to itself. The solution is that first VI waits
some time to make sure that second VI opens it self-reference.
Instead of waiting a fix time which could sometime be not enough, I do the following: second VI opens a reference to itself and writes it on a front panel refnum indicator named "Self Ref". First VI, after running second VI, polls "Self Ref" value (using "Get Control Value" on second VI) and test it until it returns a valid refnum ("Not a Path/Refnum" node).
That being said I have read that in LabVIEW 6.1 there is an option on "Open VI Reference" node to open another VI, detach it from first VI and automatically close the refnum when second VI stops. I have not 6.1 yet to test it but it seems to neatly address and solve this issue.
LabVIEW, C'est LabVIEW
02-01-2002 08:21 AM