LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PC to PC Communication using LabView

I'm going to try and keep this simple, because if I go too much into detail, I'm 100% sure the topic would quickly get bogged down.  A few simple tips might be all I need, to get me going.  I've been using LabView for about a year.  Now I need to try something I haven't done before.

 

What I want to do:

 

1) Run a piece of software on PC1.  This software would be acting to monitor the USB, to receive commands or files, from PC2.  This program on PC1 can be a labview program or some TBD program.

2) PC2 would be able to send script files to PC1

3) Scripts would be run on PC1 and return data (txt) back to labview on PC2

 

My problem is, in handling the communications.  What is the best way of going about handling the communications?  I'd prefer to use USB.  But I could use COM ports which might simplify things.  But for this discussion, let's assume USB only.  I just need to be able to send/receive text files between PC, using LabView on one end (or both ends, whichever makes more sense).

 

Mike

0 Kudos
Message 1 of 22
(7,328 Views)

I would use an Ethernet connection and communicate using TCP/IP.


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
Message 2 of 22
(7,318 Views)

@crossrulz wrote:

I would use an Ethernet connection and communicate using TCP/IP.


Me too.  However, you should also have a look at the network stream examples.

0 Kudos
Message 3 of 22
(7,309 Views)
I agree. USB from pc to pc would be very hard to implement (if even possible) and com ports slow. You have existing examples of TCP/IP so start with them.
0 Kudos
Message 4 of 22
(7,307 Views)

So, let me ask a very simple question, assuming ethernet.  Is there a simple example, anywhere, showing something trivil like:

 

Running LabView on both PCs and sending the word "hello" from one and displaying it on the the other and visa versa.  I would think for this example, the same LabView VI could be used on each PC.     

0 Kudos
Message 5 of 22
(7,304 Views)

Just search the LabVIEW examples for the term "TCP". You will find (among others) a client and a server VIs that communicate with each other.

0 Kudos
Message 6 of 22
(7,293 Views)

Take a look at this page, there are a number of examples that have some part of what you are talking about.

 

http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/ssnav:cod/q/tcp-FSLASH-ip/

 

The one refering to clusters is probably a starting place. USB to USB could be done most easily (if that is the route you want to follow) by using USB to Serial devices and using the examples for serial communications. A straight USB to USB would be difficult at best as mentioned earlier, plus the distance between the computers would be much more limited, USB really isn't good for cable lengths much more than a couple of meters.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 22
(7,291 Views)

Open LabVIEW.  Go to Help->Find Examples.  Browse according to task.  Go to Networking->TCP & UDP.  Look for Simple Data Client.vi and Simple Data Server.vi.

 

I would also look at the STM library from NI:http://zone.ni.com/devzone/cda/epd/p/id/2739


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 8 of 22
(7,281 Views)

I was just going to post that I found a couple of VI for TCP Communications, in the examples.  There is an "active" and a "passive" version.  I can run both on my local machine using localhost or my network address, and the vis do exactly what I want.  I would assume I could run one of these on another PC, inside my network and use that machine network address and they could communicate with each other.  I haven't tried that yet but this is a great start.

 

Thanks for the tips.

 

Mike

0 Kudos
Message 9 of 22
(7,266 Views)

Posted:

"Open LabVIEW.  Go to Help->Find Examples.  Browse according to task.  Go to Networking->TCP & UDP.  Look for Simple Data Client.vi and Simple Data Server.vi."

 

Ok, I have tested the Simple Data Client/Server vi.  They work great on my PC, when both are on the same PC, and using localhost.

 

I compiled an EXE and put the server on my 2nd PC, and installed the runtime engine.  Ran the server VI and it runs on that PC.   Both computers have access to the internet and access was verified, on each.  Both are on the internal side of a firewall, so there are no firewalls between client and server and no port forwarding is required.  Both VI use the same port.  I'm also using a Netgear GS105 switch.   I'm using this same setup for ethernet connections to a scope.  Works great. 

 

I assumed I could just replace the localhost setting that is on my Client computer, with the IP of the server computer (10.178.76.138), and have a connection between the client and the server.  But that doesn't work.  Connection can't be established.  Both sides just time out.

 

IP STUFF:

Client computer: IP = 10.178.76.100

Server computer: IP = 10.178.76.138

 

Can anyone tell what might be going on here that makes this not work.  OR, is it possible that these VI can't work across a network?

 

Thanks,

 

 

0 Kudos
Message 10 of 22
(7,246 Views)