08-10-2021 05:48 AM
I have trouble knowing if I should use data binding variables or network shared variables (or perhaps something else entirely.
I have a cRIO-9056, I've created a VI where I read/write data from multiple modules, so far so good. But, I want to have my main display panel running on the host computer, that would make it easier for me to communicate with other systems that are connected through USB. So, I need to transfer data from the VI running on the RIO, to the VI running on the host computer.
To accomplish this I create the DAQmx tasks, and assign them to variables in the VI running on the RIO
Then to read/write data from the VI on the host PC I found three options
1) I use the open variable connection then read/write accordingly all of this running on a loop.
2) I create the variables and then I use data binding on the properties tab.
3) I create a shared variable and attach them to an indicator/control
When I run option 1, the VI starts immediately whereas with the other two options the "Deployment Status" window pops up and it takes a little while before I can start reading/writing. Apart from that I don't see any clear difference or advantage/disadvantages
so my questions are
1) Why option 1 runs with no delay, whereas 2 and 3 show the "Deployment Status' window.
2) Is there anything wrong with the approach I'm taking?. For the moment I have a preference over option 1, but I don't know if I can run into some issues in the future. Or perhaps this is a wrong way to do what I need.
Thanks in advance.
Solved! Go to Solution.
08-11-2021 06:12 AM
Hello Andres,
Your code running on RT target looks good, but I also would suggest you to use better error handling e. g. merging errors of all tasks at the end of the code, and using a simple error handler. This can be helpful in further usage of the code. Also not forget to mention, If you don't have to acquire data from different modules at different rates, you can use one while loop and one stop button on RT VI, this can be helpful (sometimes local variables are not the best way to stop the loops). Your first approach is right, also it is mostly good to use network-shared variables to communicate between RT and Host VIs when you transfer Tag data.
Also at first run the RT VI and then start the Host VI, it is right approach to working with RT targets.
Regards.
08-13-2021 08:54 AM
Thank you for your input. I can merge the errors as you suggest, I think is a good idea. But, I do need the loops to run at different speeds, so for the moment I'd have to leave it like that.
08-16-2021 01:20 AM
Hi Andres,
I hope you are doing well. Have you solved the problem? Is everything working properly?
08-19-2021 02:16 AM
The VI is working fine, but I still don't understand why option 1 launches instantly and the other two have the "Deployment window", this difference in behavior is not clear to me.
08-19-2021 02:28 AM
I presume that such behavior is connected with the code structure. In the first case, you are using the open variables method, which doesn't need to deploy the code before running to get the data. The deployment process takes place while the code is running when the open variable sub VI is starting the process. In two other cases, the code has to refer to the RT target and project tree to get information about shared variables.
I hope that this was helpful.
Best Regards
08-19-2021 02:30 AM
Great, that makes it clear. Thank you very much.
08-19-2021 04:32 AM
I forgot to ask one more thing. Is there a reason to prefer one method over the others?
08-19-2021 06:14 AM
There are no major differences between these methods. They transfer Tag data (the last value). It is depended on your preferences and the task that the program must complete (as you could see one major difference was the deployment method). But anyway you can check it in the LabVIEW Help section, I think you can get more information there.