LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variables from PC to RT

Solved!
Go to solution

On the RT side, create the connection using TCP Listen.vi.  For STM somebody has to state what the metadata names are, so replace the Read Meta Data with the Write Meta Data on the RT side.  From there, it should work just fine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 16
(647 Views)

Hello crossruiz,

 

Thank you for getting back to me. I have tried to implement your idea into my RT vi as follows

2001J_0-1598371646860.png

Is this what you mean for me to try? I have found that there is no longer an error, but the vi pauses indefinitely at the "Create Listener" subVI. If I put a "Open TCP Connection" after the "Create Listener", then it never reaches it. If I put the "Open TCP Connection" before the "Create Listener", then I get Error 63 before getting to it.

 

As for the PC vi, I tested what it was doing, and I now know that it does not pause, so it obtains an acceptable network connection at the port. To try things out, I have wired the RemotePort from "Create Listener" to the "Open TCP Connection" to see what happens, and I find that the remote port is not the same as the written port. Why may this be? Here is a snippet of the PC.

2001J_1-1598372384325.png

 

 

- Best regards, 2001J

0 Kudos
Message 12 of 16
(643 Views)

When you create a listener, it is waiting for someone to connect to it.  You do not need the TCP Open after that because the Create Listener outputs a connection reference.  So when you start running the RT, you have to run the PC code since it is waiting for the PC to make the connection.

 

Now on the STM, only one side can write the metadata.  I recommend that be the RT.  So the PC should be using the Read Metadata.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 16
(638 Views)

Hello crossruiz,

 

I have changed the code as follows, but I now recieve Error 56. Error 56 entails that I have not received a Network response within the allotted timeframe. However, I had the RT running for a few seconds beforehand so that it could Write the metadata, but it still does not get passed the "Create Listener", so it does not get to "Write Meta Data".

 

2001J_1-1598381980118.png

The code in the left window is the PC, while the right window is the myRIO RT.

 

If I try to have the PC running before the RT, then I get the same Error 56. Should I explicitly provide my PC's IP Address as the Target IP? Also, I read "When a listen on a given port begins, you cannot use another TCP Listen VI to listen on the same port" on the documentation for the "TCP Listen" vi. Does this mean that I should have a single "TCP Listen" subVI on either the PC or the RT?

 

- Thank you, 2001J

 

 

0 Kudos
Message 14 of 16
(634 Views)
Solution
Accepted by topic author 2001J

One side needs to use the TCP Open Connection while the other uses the TCP Create Listener.  My recommendation is that the RT uses the Create Listener (ie acts as the server) and the PC using the TCP Open Connection (ie acts as the client).  Only the PC side will need to supply the address to connect to.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 16
(625 Views)

Hello again crossruiz,

 

After rewriting my program and implementing your suggestions, I was able to get my program to work. I have now replaced the shared variable system that was previously used.

 

- Thank you for your assistance, 2001J

0 Kudos
Message 16 of 16
(614 Views)