LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subVIs will not run when called by subpanel in main vi

Solved!
Go to solution

Hello all,

 

I have a main.vi which loads the front panel into a subpanel of four subVIs when selected. Like most applications, everything works well until coming to build the project (.exe). Program works as expected when run from .exe but when any functions from the vi.lib (eg read png subVI) is included into one of the called subVIs, the front panel is loaded correctly but the subVI does not run and the invoke node (Run VI produces error 1003).

 

I have inlcuded the subVIs into 'Always Include' in the build specification under the Source Files heading.

 

Please help,

 

Thank you

0 Kudos
Message 1 of 9
(6,112 Views)

That error is that the VI is not executable.  Can you share any of your code?  If you are using certain modules, you may need to always include some code from vi.lib.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(6,091 Views)

Hello Crossrulz,

 

Thank you for your response. I've created a simple project which behaves the same way as my original code. It falls apart when the read png subVI is included into the called subVI.

 

Thanks

 

Glen

0 Kudos
Message 3 of 9
(6,077 Views)

Your problem is you are trying to open a VI that is not there.  The way you are building up your path needs fixed.  I recommend using Current VI's Path and use the relative path of the VI from there.  The relative path does not change as long as you do not use the 8.X executable format.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(6,037 Views)

Hello Crossrulz,

 

Thank you for your reply. I think the path is correct to my subVIs as they load correctly and execute without problem until a subVI from the vi.lib is inserted (for example read png), then my subVI loads into the subpanel of the main VI but does not execute.

 

Thanks

 

Glen

0 Kudos
Message 5 of 9
(5,941 Views)
Solution
Accepted by topic author Glenny

I made a trivial change to your "Called" sub-VI (I created an Icon for it -- you'll see why this is important in a minute) and redid your Main VI.  This snippet is saved in LabVIEW 2015, but it is simple enough that you should be able to recreate it in whatever version of LabVIEW you are using.

 

Calling SubPanels.png

I like to use Static VI References (the first thing on this Block Diagram) because, particularly if they are associated with a sub-VI with an Icon, they provide a simple, robust, mnemonic way to get a lot of useful sub-VI "properties" (such as Path) without worrying about the Execution environment.  In particular, they work very well with the Start Asynchronous Call function, which I find much simpler to use than the VI Server method.  I'll walk you through it ...

  1. Start with a Static VI Reference to the sub-VI you want to run asynchronously.  If your sub-VI has an Icon, it will appear (as shown here) in the body of the Static VI Reference, making this somewhat self-documenting.  Notice the red Star on the top of the Static Reference -- this indicates a Strictly-Typed Reference (right-click and choose Strictly Typed), which you need for the Start Asynchronous Call.  
  2. This Reference first gets wired to a Property Node -- the unusual appearance of the node ("VI Interface Type 2") comes from the Strictly-Typed reference.  We choose the Path Property.
  3. The Path gets wired into an Open VI Reference function.  Because we are going to use Start Asynchronous Call (and Forget), we specify Option 0x80 (look at the Help for Open VI Reference for more explanation).  We also wire the Strict Type from Step 1 to the Type input of this function.
  4. The resulting VI Reference is wired to Start Asynchronous Call, which starts the Called sub-VI.
  5. We also pass this to the SubPanel Insert VI Method, which shows the sub-VI running in the Sub Panel.
  6. We now interact with the sub-VI in the Sub Panel as much as we want.
  7. In the Main routine, we are now executing the While loop, which simply waits for Stop to be pressed.  I placed a 100 msec Wait in here to give priority to the sub-VI.
  8. When we exit, we remove the sub-VI from the Sub Panel, abort it, and exit.  I see no need to put an Exit function here -- if you want to automatically close the Main Front Panel, simply do so.

Bob Schor

 

P.S. -- I tested this (in LabVIEW 2015) and it works fine.

Message 6 of 9
(5,918 Views)

Hi Bob,

 

Thank you for your help. It now works!

 

Glen

0 Kudos
Message 7 of 9
(5,785 Views)

Just wanted to say THANKS for this post!!! I've been looking for an answer to this for ages!

0 Kudos
Message 8 of 9
(4,513 Views)

Hi Guys, also thanks for the cood example above.

 

For my case i just found out that i forgot to include some Sub-VIs or libraries. After including them into the build specifications it worked again (can´t remember i deleted them from the build specifications....)

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