LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call VIs from a host to run on a target

I already implemented a launcher on my host. The goal is to run different VIs when a button is pressed. Each VI has its own button and is supposed to execute exactly one time. The VIs are stored on the host but they are supposed to be executed on the target. Is there any ways to do this automatically?

 

I already tried different methods:

(1) Open the launcher on the host and manually opening a VI on the target and then starting the execution with global variables. It works well but I would like to avoid the manual opening of the VI on the target.

(2) Using a VI Server and the IP of the target to run the VI on the target. This works also well but only if the VIs are saved on the target. In my case this is unfortunately not possible because I am using MAX. There are certain defined task such as opening the brakes or actuating the motors which I am using. The MAX runs on the host and when I try to execute a VI which is saved on the target, it cannot use those defined tasks.

 

What I would like to know is, if there is a way to run a VI, which is stored on the host, on the target without opening the VI on the host?

 

Best,

Lea

0 Kudos
Message 1 of 6
(1,994 Views)

Can anybody help me with my problem?

0 Kudos
Message 2 of 6
(1,966 Views)

I was able to locate my problem a little bit more:

 

With my VI Server I can call a VI to run on the target without any problems as long as I am not using MAX tasks. MAX stands for Measurement and Automation Explorer. There I defined some tasks such as opening the brakes or running the motors. When I try to include such predefined tasks into my VI and run it one the target the error 200428 shows up.

 

I attached my project and my files that I am using. I tested m VI Server with the program "Untitled 3" on the host. It will call the VI "Test" on the target. As long as the MAX tasks in the VI "Test" are diables, there will be no problem, but when the Disable Structure will be removed, it will not work anymore.

 

Does anybody know, how I can include the MAX tasks correctly?

 

Best regards,

Lea

0 Kudos
Message 3 of 6
(1,955 Views)

Hi Lea,

 

the tasks are not properly configured for your target in MAX. You should either be able to go to your target in MAX and create the appropriate

Tasks on the target, or, and that is even safer method, use the DAQmx-API to create the tasks within your target VIs (create an init VI which creates all neccessary tasks

with the DAQmx Create Task VI, for example).

 

Error code: - 200428
Description: Value passed to the Task/Channels In control is invalid. The value must refer to a valid task or valid virtual channels.
Possible cause: The task has not been created or has been saved with errors.
Solutions: Ensure that the task exists in Measurement and Automation Explorer first. If it does, then open the task and make sure that it does not have any errors. 

 

For VI-Server you can just work like on a windows system. Just make sure the VIs that you call in are there and you use the right paths.

You could initiate an automatic FTP-Transfer of your Plugin-VIs from your Host to the target using standard ftp commands in a commandline.

 

 

best

 

Marco Brauner NIG 

0 Kudos
Message 4 of 6
(1,950 Views)

Hi Marco,

 

thank you for your help. I tried to create my tasks with the DAQmx Create Task VI but another problem showed up.

 

In my MAX software I have two subgroups: "My System" and "Network Environment". My tasks and channels are saved under Network Environment and as long as I am deploying my "test.vi" manually it will find these. But when I try to run the "test.vi" by calling it in the "Untitled 3.vi" those channels no longer can be found. I figured out that in this case it will no longer search for the channels in "Network Environment", but it will try to find them in "My System" which wont be possible. There for either the error 200488 or 200220 will show up. I also attached a screenshot of my MAX software.

 

Is there a way to tell the VI that it is supposed to look for the channels in the "Network Environment"?

 

Best,

Lea Koch

 

Download All
0 Kudos
Message 5 of 6
(1,928 Views)

Hi Lea,

 

I don´t know what prevents the tasks from being found, but anyway I would go for a simple workaround:

 

right-clicking the DAQmx-Task control on your plugin-Blockdiagram and converting the task into configuration code.

Maybe you should start with a simple one channel test-VI as an example.

Also please make sure to close VI-references in your code once you don´t need them anymore.

 

best

 

Marco Brauner NIG

 

0 Kudos
Message 6 of 6
(1,910 Views)