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

I tried the method you have suggested. But I am getting an error. The camregv1.vi pops up, but i doesn't run. Please see the attachment of what I have done.

Download All
0 Kudos
Message 21 of 28
(1,832 Views)
Solution
Accepted by topic author skariaroy

Right click on your error code and pick Explain Error.  There is a whole lot more text there that might guide you to the answer about the way you open the VI reference.

Message 22 of 28
(1,819 Views)
Solution
Accepted by topic author skariaroy

Please read the option description here: https://zone.ni.com/reference/en-XX/help/371361H-01/glang/open_vi_reference/

-you might give 0x80 or 0x100 based on your requirements.

Thanks
uday
Message 23 of 28
(1,801 Views)

Well, you are still being "stingy" with your code -- the tidbits you deign to show us are missing so many pieces that the MainTest has broken arrows due to missing VIs.

 

I cannot "see" the problem you are having, but I can illustrate a variation on your code that Hooovahh was describing.  Here is the Call-by-Reference code in MainTest using a Static VI Reference (I gave CamSetV1 an Icon, both because every VI you write should have an Icon, and because it helps make LabVIEW code self-documenting).

CallByReference.png

Several things note, here.

  • The "Red Star" in the Static VI Reference is because I right-clicked and made it a Strictly-Typed Reference, needed for Open VI Reference to get the connector pane right.
  • By using the Path Property of the Static Reference, the code doesn't have to worry about the path.  Great when building Executables!
  • If you are using Start Asynchronous Calls, you'll need to set the Option parameter on Open VI Ref to 0x80 or 0x100.

Bob Schor

0 Kudos
Message 24 of 28
(1,779 Views)

In the example I linked to there was no front panel open, and no Run VI function and it worked, and the open had an option that is important to it working correctly.  You should examine how that demo worked and make your setup work the same way.

Message 25 of 28
(1,778 Views)

Hello , I gave the option field as 0x80 and everything worked fine. But I got an error code 1000. The VI is not in a state compatible with this Operation. What does that mean.

0 Kudos
Message 26 of 28
(1,764 Views)

@skariaroy wrote:

Hello , I gave the option field as 0x80 and everything worked fine. But I got an error code 1000. The VI is not in a state compatible with this Operation. What does that mean.


That means whatever you tried to just do is not allowed at that moment.  Like trying to run a VI that is already running.  What method or property generated that error and what state was the VI in when it was generated?

0 Kudos
Message 27 of 28
(1,752 Views)

Got it working. The assynchronous call run the VI. There is no need for another RUN VI. Kudos to all. I am attaching the final working solution.

0 Kudos
Message 28 of 28
(1,744 Views)