LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I call sub vi's remotely on PXI RT Target from Host Laptop?

Solved!
Go to solution

I have about 20 sub-vis on my PXI RT target that I want to run exactly one time when commanded from my Host laptop front panel. There must be an easy way to do this but I am still fairly new to LV. The way I am doing it now is by commanding a shared variable (latched-boolean) from the host to trigger a case structure on the target. This works the vast majority of the time, but the problem with this is that sometimes the host vi will finish executing its loop and latch the boolean back to false before the target has a chance to run the sub-vi. What is the correct way to do this??

 

Host_and_Target_VIS.PNG

Download All
0 Kudos
Message 1 of 8
(4,324 Views)
Solution
Accepted by topic author Michael_Fidler

Hi Michael,

 

I am glad to help with your question. Some nice ways to accomplish what you are trying to do are mentioned in this document: (http://digital.ni.com/public.nsf/allkb/F64D92E0BCA34162862573BD0072F807). 

 

Specifically, I would recommend using VI Server to programatically run LabVIEW Real-Time VIs from a host application on your laptop. Please let me know if you need additional information on how to do this, or if you try it out and have any problems. Note that you will have to make sure that your subVIs and all dependencies are copied to the real-time target hard drive for this method to work.

 

Best Regards,

 

Casey Weltzin

Product Manager, LabVIEW Real-Time

National Instruments 

Message 2 of 8
(4,309 Views)

Thanks for the prompt reply, Casey.

 

I tried to get this to work but I am having problems. It is working fine if I deploy the "SubVI.vi" from the project to the target before I call it from the host, but I can't figure out how to dynamically load the "SubVI.vi" to the target. Since I have over 20 sub-vis I don't want to deploy them all from the project and have open front panels on my host before I even run the host vi. 

 

I tried wiring an actal path to "VI Path", but that didn't work either. Any thoughts?

 

 

Host_and_Target_VIS_2.PNG

Error_1004.PNG

 

If I right click "Sub_VI.vi" in the project file tree and click "Deploy", it works and I don't get this error...

Download All
0 Kudos
Message 3 of 8
(4,301 Views)

Hi Michael,

 

Instead of using a VI name inside of a string constant, try using a VI path inside of a path constant. This will load the VI from disk (as long as the VI and all dependencies have been copied over to the RT target). Using a source distribution is probably the best way to make sure that all source files needed are transferred over.

 

Regards,

 

Casey Weltzin

Product Manager, LabVIEW Real-Time

National Instruments 

Message 4 of 8
(4,299 Views)
How do I point the path to the PXI hard drive? My PXI IP address is 192.168.4.241. I copied the Sub_VI.vi file over to the PXI hard drive via FTP in Windows Explorer. Thus, I can see the file is there in the top directory at ftp://192.168.4.241/Sub_VI.vi, but how do I put that in a path constant? There is no way to browse to the RT destination after I right click the path constant and click "Browse for Path"...
0 Kudos
Message 5 of 8
(4,291 Views)

Hi Michael,

 

Just use an absolute path like "c:\foldername\viname.vi". The target should already be specified with the Open Application Reference function. Please let me know if you need any additional help and I'm glad to assist.

 

Best Regards,

 

Casey Weltzin

Product Manager, LabVIEW Real-Time

National Instruments

 

0 Kudos
Message 6 of 8
(4,263 Views)

Thanks for the help, Casey. I didn't realize that the hard drive on the PXI was the "C" drive! It works!

 

 

Host_and_Target_VIS_3.PNG
0 Kudos
Message 7 of 8
(4,259 Views)

Hi Michael,

 

You're very welcome, and I'm glad everything is working for you at this point! As a final suggestion, if the user will be triggering execution of your RT VIs you may want to look into creating an event-driven design for your final application. 

 

This reference should help: (http://zone.ni.com/devzone/cda/tut/p/id/3331).

 

Regards,

 

Casey Weltzin

Product Manager, LabVIEW Real-Time

National Instruments 

0 Kudos
Message 8 of 8
(4,235 Views)