11-19-2008 07:48 AM
Iam trying to start a thread by dynamically calling a re-entry vi and get a calling reference therefore. When I need to close the vi, I just use that vi reference to close it.
But I got the Error 1000 LabVIEW: The VI is not in a state compatible with this operation.
Please see the attached piece code for the way I am open and close it(, since the original code is a bit complex)
P.S.
What is the best way to stop one of the multi dynamically called out re-entry vi outside itself somewhere else.
Also if multi instances of one re-entry vi are called out, how to monitor their existing status in debugging, such as whether they been killed. The log file some time is a bit slow.
Thanks
Solved! Go to Solution.
11-21-2008 03:21 AM - edited 11-21-2008 03:22 AM
Hi,
Even though the subVI that you called is running, it is not running under its own execution; it is part of the execution of the top-level VI. The execution of a VI depends on the execution of the subVI that is called, so you are not allowed to abort the execution of a subVI. Even though two parts of the main VI may be running in parallel (the subVI and the VI Server Abort command), the subVI is not executing on it's own; it is part of the caller VI.
In order to abort a subVI from another VI, it needs to be running as a VI, not as a subVI. To make this happen, you would need to start the subVI through VI Server, using an Invoke node with the Run method. You also need to set the Wait until done option to False to eliminate the data dependencies of this VI. This way you can run and abort a VI from another VI. The major drawback to this however, is the greater difficulty of passing data values to the called VI. You would have to use the Set Control Value and Get Control Value methods to pass data to and from the called VI. I attached the examples below.
Sincerely,
Gunyapart Deephanphongs
Application Engineer
NI ASEAN
08-19-2009 02:09 PM - edited 08-19-2009 02:10 PM
Hi, this solution is appreciated. However, I am running multiple subVIs from the main VI, therefore, I am passing the parameters to a middle VI (launcher) which RUNs the subVI. launcher VI has exactly the same architecture as in This.vi with only more parameters, it is called in a loop to run multiple subVIs with different parameters, but still I get the same compatibility error message on the first subVI run!
Sia
08-19-2009 02:49 PM
got it right now!
the subVI is to be .vit as for template.
Sia
08-21-2009 12:49 AM