From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Open VI and passing a parameter to the dynamically opened VI

Solved!
Go to solution

Share the code which you tried.so that you will get the exact solution.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 11 of 28
(2,008 Views)

I am attaching my code snippet and the error.

Download All
0 Kudos
Message 12 of 28
(1,994 Views)

The error is solved. I am posting my new code. But it is not opening the VI. I ran the VI with 'Highligh execution'. The program is not coming out of the Pass by reference node. It is stuck inside the pass by reference node.

0 Kudos
Message 13 of 28
(1,984 Views)

Sigh.  Time to Rant and Rave again.  Showing us a picture of part of your code is almost useless to us.  Think about it -- you have a problem with your code, you don't know where the problem is, so you show us a tiny picture of part of the code, which may well be far away from the True Problem (and, in your case, almost certainly is), and are frustrated when we can't quickly "fix it" for you.

 

So let me tell you exactly the steps to follow to get all of your code to us, so we can look at it all, understand where the Coercion Dots (did you see those?) are arising (and causing your error), and can suggest solutions.

  1. Gather all of the VIs that you've created that are part of your program into a single Folder.  If you are using LabVIEW Project to manage your project, this may already be the case.
  2. Right-click the folder with all of your VIs (and Controls), choose Send To, and choose Compressed (zipped) Folder.
  3. Attach the resulting .Zip file to your reply.

Bob Schor

0 Kudos
Message 14 of 28
(1,982 Views)

Thanks for the fast reply. I am attaching the two VIs. The maintest.vi is run first. When I press OK Button, it should popup the camsetv1.vi and run it. It should pass two Unsigned 32 bit parameters to the new VI. The camsetv1.vi have an infinite while loop in it.

0 Kudos
Message 15 of 28
(1,980 Views)

Huh?  There is no OK button, there is (in Main Test) no calls to camsetv1.

 

Oops, I didn't see the "orphan" Case Statement below the While Loop in Main that's trying to open "delay.vi" (which does who-knows-what).

 

I don't know about my colleagues, but I'm getting frustrated by the amount of time I am wasting trying to help you when you won't do what is necessary for us to be able to do so.  I'll repeat and expand on the first part of my request:

  1. Gather all of the VIs that you use in your code in a folder and send us the compressed folder.

I'm guessing that you created a Passbyreference folder, put two VIs in it, and sent that along.  No, that's not helpful (to us, and ultimately to you).  Take your existing folder, even if it is messy, has lots of "junk" in it, etc., compress it, and attach it.  [OK, you can clean it up a little, but before attaching it, be sure that the code inside the folder is complete and illustrates your issue!]

 

Note that aside from the inoperable Run VI Invoke Node in MainTest, I saw nothing related to Dynamically Open VI and passing a parameter to the dynamically opened VI in what you sent.

0 Kudos
Message 16 of 28
(1,973 Views)

Oops, LabVIEW is saving the VIs at random locations, messing things up. Please find the new attachment. The camsetv1.vi calls some library functions which helps to talk to our camera. 

0 Kudos
Message 17 of 28
(1,969 Views)

Dude...

 

Clearly LabVIEW asked at one point where you wanted to save dllreg.vi and you told it to save at C:\Users\Skaria\Desktop\Fastec\LabVIEW\dllreg.vi.  It wasn't random and it isn't messing it up.

 

In addition to this you seem to be missing unreg.vi, camreg.vi, camunreg.vi, and camset.vi in your zip.

 

As far as calling camsetv1.vi I think you have it done right with the strict VI type matching the one you specified, but why are you doing this in the first place?  Is there something wrong with just calling the sub VI instead of calling it by reference?  If you are meaning to make multiple windows of this VI you'll need to perform a call and forget.  Calling it by reference like you have will do the same thing as calling the sub VI statically.

Message 18 of 28
(1,966 Views)

I want to popup camregv1.vi. I addition I want to pass two parameters to the VI. Invoke node allows me to popup the camregv1.vi . but it will not take any parameters. 

0 Kudos
Message 19 of 28
(1,961 Views)
Solution
Accepted by topic author skariaroy

If you are using the invoke node method you can set the control values using other methods before invoking Run.  Of course the more modern way is to use static VI references, and the Start Asynchronous Call.  Take a look at this example I posted a while ago.

 

http://forums.ni.com/t5/LabVIEW/building-an-executable-with-vits-with-Labview-2011/m-p/2384984#M7404...

 

Run the Launch.VI and it will open N new windows.  If you add inputs to the terminals of the Reentrant.vi they will show up on the terminals of the Start Asynchronous Call and those inputs will be used when that instance of that VI is ran.  This works by using static VI references, with the type included.  This also has the added benefit of not caring on disk where the VI is stored.  When making an EXE the VI is included in the EXE and used.

Message 20 of 28
(1,954 Views)