01-13-2010 12:11 PM
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??
Solved! Go to Solution.
01-13-2010 02:14 PM
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
01-13-2010 03:37 PM
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?
If I right click "Sub_VI.vi" in the project file tree and click "Deploy", it works and I don't get this error...
01-13-2010 04:03 PM
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
01-13-2010 04:33 PM
01-14-2010 09:57 AM
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
01-14-2010 10:12 AM
Thanks for the help, Casey. I didn't realize that the hard drive on the PXI was the "C" drive! It works!
01-14-2010 03:56 PM
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