Industrial Communications

Showing results for 
Search instead for 
Did you mean: 

Modbus TCP - Access Multiple slave devices on same gateway

Go to solution



I have am trying to read from multiple Modbus Serial slave devices (2 to start with) via a 4 port Modbus serial to ModbusTCP Gateway.The gateway has a web configuration page that allows me to configure each port individually (baud rate, parity etc.) along with modbus mapping/offset.


In labview modbus TCP master VI's i dont see an option to select "Unit ID". Similar to modbus serial VIs. Is there an alternate way to do this?


I can read from slave device on Com1 just fine from my labview master application, but nothing from device on port2. Diagnostics from the webpage tell that my request is also not getting to Com2.

0 Kudos
Message 1 of 5



The slave address is a part of the TCP data (the CRC is not) Using different slave addresses to select a port at your gateway should work. At least with my Moxa gateway it does.



0 Kudos
Message 2 of 5
Accepted by topic author Younus.M
01-09-2018 10:22 AM

Setting the Unit ID via Property Node worked! I can now read for the 4 com ports using their corresponding slave addresses/unit IDs. 


The LabVIEW context help for unit ID was throwing me off as it says "...specifies identification of a serial modbus slave.....ignores requests from TCP Mobdus Master instances....". Now I know that i not true Smiley Happy it works just the same both serial & TCP

0 Kudos
Message 3 of 5

Hi Younus. I couldn't understand your way. Someones told me for 4 slave like in this VI;

serial tcp.png

 but it is not working. Can you give me an example ?  In the snippet, it is created for loop for 4 slave devices ID and inside the while loop, take the element ID number and write in sequentially to those Modbus Read holding Register vı. I think there is an error here. We need not for loop, instead of that, we have to define slave IDs separately?

0 Kudos
Message 4 of 5

I made some modifications on the basis of NI Modbus Library, and realized the communication between Modbus Slave and Master through multiple unit ID.So I publish the code using LabVIEW 2013.

Hope it works for you.

0 Kudos
Message 5 of 5