EasyManua.ls Logo

Siemens SIMATIC S7-1200

Siemens SIMATIC S7-1200
1614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Communication processor and Modbus TCP
13.5 Modbus communication
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1185
Table 13- 69 MB_SERVER execution condition codes
1
STATUS
(W#16#)
Response code
to Modbus serv-
er (B#16#)
Modbus protocol errors
7001 MB_SERVER is waiting for a Modbus client to connect to the assigned TCP port. This
code is returned on the first execution of a connect or disconnect operation.
7002 MB_SERVER is waiting for a Modbus client to connect to the assigned TCP port. This
code is returned for any subsequent executions, while waiting for completion of a connect
or disconnect operation.
7003
A disconnect operation has successfully completed (Only valid for one PLC scan).
8187 MB_HOLD_REG is not valid, could be pointing into an optimized DB, or is pointing to an
area of less than 2 bytes.
818C Pointer MB_HOLD_REG points to a non-optimized DB area (must be a non-optimized
global DB area or M memory area) or Blocked process timeout exceeds the limit of 55
seconds. (S7-1200 specific)
8381
01
Function code not supported
8382
03
Data length error
8383
02
Data address error or access outside the bounds of the MB_HOLD_REG address area
8384
03
Data value error
8385
03
Data diagnostic code not supported (function code 08)
1
In addition to the MB_SERVER errors listed above, errors can be returned from the
underlying T block communication instructions (TCON, TDISCON, TSEND, and TRCV).
13.5.2.4
Modbus TCP examples
Example: MB_SERVER Multiple TCP connections
You can have multiple Modbus TCP server connections. To accomplish this, MB_SERVER
must be independently executed for each connection. Each connection must use an
independent instance DB, connection ID, and IP port. The S7-1200 allows only one
connection per IP port.
For best performance, MB_SERVER should be executed every program cycle, for each
connection.
The CONNECT parameter uses system data type TCP_IP_v4.For the example, these data
structures are in a DB named "Modbus connections". The "Modbus connections" DB
contains two TCP_IP_v4 structures "TCPpassive_1" (for connection 1) and "TCP_passive_2"
(for connection 2).The connection properties ID and LocalPort described in the network
comments are data elements stored in the CONNECT data structure.
The TCP_IP_v4 CONNECT data also contains an IP address in the RemoteAddress ADDR
array. IP address assignments within TCPpassive_1 and TCP_passive_2 do not affect the
establishment of TCP server connections, but determine which Modbus TCP clients are
allowed to communicate though the connections to each MB_SERVER. MB_SERVER
passively listens for a modbus client message and compares the incoming message IP
address with the IP address stored in the corresponding RemoteAddress ADDR array.

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals