LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus TCP/IP

Hi,

I'm going to create a LabView project, in order to connect with a PLC S7-1500 via Modbus TCP/IP.

The problem is: In TIA Portal, I found a function named "Modbus TCP Client" for S7-1500. However, in NI LabView, while I use Modbus Library, I can choose between Modbus TCP Master and Modbus TCP Slave.

 

1) When do I call it Modbus TCP Master/Slave and when to call it Modbus TCP Server/Client?

2) So because the S7-1500 is a Modbus TCP Client, my Labview project has to be a Modbus TCP Server, right? Then how should I config it? A Master or a Slave?

 

I followed this sample in NI forum: Modbus TCP Sample 

Thank you

 

 

 

0 Kudos
Message 1 of 6
(2,391 Views)

Typically Master=Server.   Slave=Client.

Master=Client. Slave=Server  (Thanks to drjdpowell correcting me.)

 

Devices tend to be slaves.

So your PC should probably be a master.

 

But that would mean your PC is a Client of the device which is "serving" up the data.

0 Kudos
Message 2 of 6
(2,374 Views)

Master/Slave is terminology from Modbus Serial or RTU, not TCP.  TCP is Client/Server.  Your device would be a "Slave" if Modbus serial, or a "Server" if Modbus TCP.  

0 Kudos
Message 3 of 6
(2,356 Views)

Hi RavensFan. Actually the code for device (S7-1500) has been written already, and it config the device as a client. Also, my purpose is to read and write data between device and PC, so is it possible to config PC as Modbus TCP Slave to match my requirement? Thank you

 

0 Kudos
Message 4 of 6
(2,337 Views)

Hi drjdpowell. I have a further question as I reply to Ravens lFan. Can you take a look? I also find on the Internet that Master/Slave is only used for Modbus RTU. However, in NI Labview Modbus Library, it show 2 options for Modbus TCP as Master and Slave, that's why I'm confused

0 Kudos
Message 5 of 6
(2,333 Views)

I don't know what you mean by "TIA portal",  nor what "code for device is already written".  Is that LabVIEW code?

 

Yes, you can make your PC a slave.  That means the other device is the master and will send queries to the PC to get the data.

There are examples in the modbus library for a slave.  Generally that means that the LabVIEW code is running and waiting for a connecting from the remote master looking for commands.

 

Though I've played with making a PC the slave device before (mostly to simulate a slave I didn't have on hand), the vast majority of my work the PC is the master querying the remote slave device for data.  And the majority has been RS-485 serial RTU, not TCP/IP.

0 Kudos
Message 6 of 6
(2,330 Views)