105BCommunication processor
12.5 Modbus communication
S7-1200 Programmable controller
588
System Manual, 11/2011, A5E02486680-05
●
Complex DB elements can be assigned by MB_DATA_PTR, such as
–
Standard arrays
–
Named structures where each element is unique.
–
Named complex structures where each element has a unique name and a 16 or 32 bit
data type.
●
There is no requirement that the MB_DATA_PTR data areas be in the same global data
block (or M memory area). You can assign one data block for Modbus reads, another
data block for Modbus writes, or one data block for each MB_CLIENT station.
Multiple client connections
A Modbus TCP client can support concurrent connections up to the maximum number of
Open User Communications connections allowed by the PLC. The total number of
connections for a PLC, including Modbus TCP Clients and Servers, must not exceed the
maximum number of supported Open User Communications connections (Page 394). The
Modbus TCP connections may be shared between Client and/or Server type connections.
Individual client connections must follow these rules:
●
Each MB_CLIENT connection must use a distinct instance DB
●
Each MB_CLIENT connection must specify a unique server IP address
●
Each MB_CLIENT connection must specify a unique connection ID
●
Unique IP port numbers may or may not be required depending upon the server
configuration
The Connection ID must be unique for each individual connection. This means a single,
unique Connection ID must only be used with each individual instance DB. In summary, the
instance DB and the Connection ID are paired together and must be unique for every
connection.
Table 12- 52 MB_CLIENT user accessible static variables
Variable
Data type Default
description
Blocked_Proc_Timeout
Real
3.0
Amount of time (in seconds) to wait upon a blocked Modbus client
instance before removing this instance as being ACTIVE. This can
occur, for example, when a client request has been issued and then
application stops executing the client function before it has completely
finished the request. The maximum S7-1200 limit is 55 seconds.
MB_Unit_ID
Word
255
The Modbus TCP protocol unit ID. This value is initialized to a default
value of 65535. This field corresponds to the slave address field in the
Modbus RTU protocol. The value should be changed if a Modbus TCP
server is capable of being used as a gateway and is controlled by the
corresponding application program within the Modbus server. Some
devices require this value to be set to a value of 1.
RCV_TIMEOUT
Real
2.0
Time in seconds that the MB_CLIENT waits for a server to respond to a
request.
Connected
Bool
0
Indicates whether the connection to the assigned server is connected
or disconnected: 1=connected, 0=disconnected