Technical Forum

Communication / Networks

When to use multiple CONNECT_ID with MB_CLIENT on S7-1200

Thread Starter: Saint Germain   Started: 3/6/2012 11:25 PM   Replies: 3

« Previous thread Next thread »
Page 1 of 1 (4 items)
  3/6/2012, 11:25 PM
Joined 8/18/2010
Last visit: 10/15/2014
Posts: 32
Rating:
Rated: Excellent [4.5 out of 5 / rated 2 time(s)]. (2) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
When is a different connection ID required to be used on the MB_CLIENT instruction?  Is it when you connect to a different MB_SERVER with a different IP address?

I need to send a cyclic request to 10 modbus TCP servers.  Each server has a seperate IP address.  I was wondering if I should use a different connection ID and Instance DB for each of these request.
Top
  3/7/2012, 11:20 AM
Joined 7/24/2008
Last visit: 10/31/2014
Posts: 2517
Rating:
Rated: Excellent [4.34 out of 5 / rated 446 time(s)]. (446) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hi,

Each connection Client - Sever is different and need a different connection ID.
Remember, however that you just have 8 TCP connections avaliable in the S7-1200 sad

Denilson Pegaia
Siemens Industry Sector
- Technical Support & Hotline -
Hotline – Atenção ao Cliente / Customer Care
Tel.: +55 11 3833-4040
E-Mail: atencao.cliente.ac.br@siemens.com
Top
  3/7/2012, 4:42 PM
Joined 8/18/2010
Last visit: 10/15/2014
Posts: 32
Rating:
Rated: Excellent [4.5 out of 5 / rated 2 time(s)]. (2) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
So with only 8 connections available, can I have 10 server connections in my program, but only have max of 8 active or "connected" at a time?

I will try this out an post my results.
Top
  3/9/2012, 6:04 PM
Joined 8/18/2010
Last visit: 10/15/2014
Posts: 32
Rating:
Rated: Excellent [4.5 out of 5 / rated 2 time(s)]. (2) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

This is what I found out.

Each MB_Client to MB_SERVER connection requires a seperate CONNECT_ID.  There are a total of 8 connections that can be active at one time, as Pegaia stated.

If you are using multiple MB_CLIENT instructions to connect to the same MB_SERVER, lets say one to read holding registers and another to write holding registers to the same PLC, they can then have the same CONNECT_ID, but will require different IP_PORT numbers.  The PLC in this case will require two MB_SERVER instructions, each with their own IP_PORT number.  You also cannot have more than one MB_CLIENT instruction, with the same CONNECT_ID, sending a request at the same time.  You will need to handle the sequencing in your program so that only one of these are sending a request at a time.

 If you need to communicate with more that 8 Modbus Servers, as I did, this is possible if you follow these guidelines.

1. Only 8 Client/Server connections can be active at a time.
2. You must "Disconnect" one or more of the MB_CLIENT instructions to free one or more of the 8 available connections by setting the DISCONNECT input on the MB_CLIENT instruction to TRUE.
3. Make sure you do not disconnect the client while it is processing a request and is in the busy state.  This is accomplished by monitoring the static bit "CONNECTED" that is located in the clients DB and the output bit "BUSY".
4. Once the 8th client TCP connection is disconnected, you will be able to "connect" your 9th MB_CLIENT connection.

Here is an example of how to write the logic to Disconnect and ReConnect the MB_CLIENT


Attachment: MB_Client.JPG  (308 Downloads)

Top
Thank you for this post from:
Page 1 of 1 (4 items)
Actions