Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Modbus TCP - Access Multiple slave devices on same gateway

Solved!
Go to solution
Highlighted

Modbus TCP - Access Multiple slave devices on same gateway

Hi,

 

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
(1,605 Views)

Re: Modbus TCP - Access Multiple slave devices on same gateway

Hi,

 

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.

 

Kees

0 Kudos
Message 2 of 5
(1,558 Views)
Solution
Accepted by topic author Younus.M
01-09-2018 10:22 AM

Re: Modbus TCP - Access Multiple slave devices on same gateway

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
(1,545 Views)

Re: Modbus TCP - Access Multiple slave devices on same gateway

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
(952 Views)

回复: Modbus TCP - Access Multiple slave devices on same gateway

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
(869 Views)