06-05-2010 12:39 AM
Hi,
I have recently started using LabVIEW Real time. I want to transfer an array of data from a desktop PC to a real time PC. The transfer of data is one time and the real time PC will do further processing on the data. I am using LabVIEW 8.2 and the corresponding LabVIEW Real time version. I do not understand how to program the real time PC to receive all the array elements in order. Given below is a brief description of what I have tried so far.
Initially, I created a shared variable on the target PC which was of data type double. I enabled 'Buffering' and set size as 10 doubles. In the real time FIFO tab, I enable real time FIFO, selected Multiple elements and set size as 10 doubles. On the desktop PC, I used a for loop to transfer every element of the array to the shared variable. I used a delay of 500 ms in the for loop for debug purposes. On the target PC side, I used a while loop, the same delay of 500ms and built an array by reading the shared variables. To execute the program, I first ran the VI on the target PC and then the VI on the host. I could see that the array was being filled up with data from the host PC, but the first element of the array from host PC was filled in the second element of the array on the target PC. Another problem was that there was no way to notify the target PC that the host PC had sent all data and it had to stop filling the array. The first problem with misalignment of data can be attributed to timing. But I am not sure how to solve both the problems.
I also tried declaring the shared variable on the target PC with data type 'Array of double'. But when the data is passed from the host PC to the target PC, I do not see the variables reflected on the target PC.
Could anybody please tell me what mistake am I doing here?
Solved! Go to Solution.
06-07-2010 05:30 PM
I'm curious about how you have this application set up. Are you using a Project and set up the Shared Variable here? Can you post your Project so that we can look at it?
Also, is there a reason you are using the shared variable of data type double and writing it it mulitple times? Is it because when you used the 'Array of Double' you couldn't see any data on the target PC?
06-08-2010 03:30 PM
Hello Stephanie,
Thank you for replying. With reference to your questions, I tried the 'Array of Double' data type after I tried 'Double' data type. However, with both methods, I am unable to transfer data from host PC to RT PC. I am attaching two projects. The file ex1.zip contains shared variable of type 'double'. The file ex2.zip contains shared variable of type 'Array of double'. My labVIEW version is 8.2 and Real-time version is 8.2
06-09-2010 02:39 PM - edited 06-09-2010 02:40 PM
I looked at your project and modified it a little bit. I focused on using the shared variable of type 'Array of Double'. It seems like you set up the shared variable correctly. However, I did remove the sequence structure and replaced it with a while loop and when I did this I was able to update the shared variable in the host.vi and saw the updates on the target.vi. I've attached the project below.
Can you take a look at this and let me know if it works for you. Feel free to modify it to suite your application needs.
06-10-2010 10:09 AM
Hello Stephanie,
Thank you for your help. The real time project you provided works remarkably well. But if you remember the first post, I mentioned that the transfer of data from host PC to real time PC is one time. In the example you provided me, the array is being written to again and again. Since I wanted the data transfer to occur only once, I was using a flat sequence structure.
Regards,
Prashant Kasbekar
06-10-2010 10:27 AM
The best way to tranfer Data between RT and Host-PC is the TCP/IP connection. I would suggest you to make a TCP loop on the Host side
to send the data and a TCP loop on the RT side to receive the data.
It depends on the project, shared variable solution could make some performance problem.
06-11-2010 03:56 AM
see this example with TCP Loop.
First you have to run the host VI and then deploy the RT VI.
I hope it helps.
06-16-2010 10:23 AM
Hi,
The problem has been solved. The issue was LabVIEW Real Time 8.20 which was corrupted. Hence did a re-installation of LabVIEW. Now the example project I attached (ex2.zip) in the previous post works perfectly. I thank you for all your help.
Regards,
Prashant