LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple TCP/IP connections

Hello, 

 

I am new with labview and I am trying to connect WAGO controller with LabVIEW 13  through modbus protocol via TCP/IP. Now, the question is how can I have multiple TCP/IP connections in the same LabVIEW project but different VIs? I am using MB ethernet master query.vi to write and read registers. Any suggestion would be very helpful to me. 

 

Thanks and Regards

0 Kudos
Message 1 of 19
(5,021 Views)

"can I have multiple TCP/IP connections in the same LabVIEW project but different VIs?"

 

short answer: yes.  You just need to make sure that you manage the ip and port constraints and you should be a-ok...

 

I've done this before using multiple acromag boards that use modbus in the same project/application.  I used LVOOP where each acromag had its own class and managed its own modbus session.

 

-pat

0 Kudos
Message 2 of 19
(4,966 Views)

Thanks for your reply Pat! 

 

as you said you used multiple Acromag boards in your system but in my application I have only one WAGO controller so requirement would be to have multiple TCP connections with same port number and same IP address. Sorry for not clearifying in the first post! 

0 Kudos
Message 3 of 19
(4,940 Views)
Yes, that is possible too. But it could be that your WAGO Controller accepts only a limited number of connections.

Regards, Jens
Kudos are welcome...
0 Kudos
Message 4 of 19
(4,930 Views)

Instead of having multiple VIs in the same program that all establish a connection to the same unit, it would be much better to have a single VI in its own loop that is responsible for all modbus communication, and then feed values in and out of it (using queues, notifiers, or functional global variables as appropriate for the type of data and update frequency).

Message 5 of 19
(4,902 Views)
Yes, Nathan's idea is a good one to remember any time you have a common resource that will be accessed from multiple locations. In addition to instrumentation, I have used this idea for files and database connections.
An added benefit is that it allows you to redefine the interface to the resource to make it easier to access. In fact you could even use it to hide the exact nature of the resource you are accessing.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 19
(4,893 Views)

Thanks Nathan and Mike for replying.. Having a songle loop for all communication was the last option I kept in mind as I wanted to avoid using global variables and also having multiple queues or notifiers in a vI create problems sometimes. I tried using 3 queues to pass data in a same VI but not all of them were passing data so I thought of having multiple TCP connections. 

Message 7 of 19
(4,848 Views)
Why would you need to have multiple queues? You could also use a user-defined event (UDE) to pass data to the IO process -- my preference -- and if a reply was needed, use a named notifier.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 19
(4,831 Views)

Hello, Mike sorry I am really new to LabVIEW so could you please elaborate a bit about UDE to pass data? 

0 Kudos
Message 9 of 19
(4,816 Views)

if you create an event of some data type and pass it into two different process, you can register for the event in/before one process, and then generate the event when necessary in the other process, passing the data of interest to the handler.

 

-pat

Message 10 of 19
(4,812 Views)