|
Home | Explorer | Siemens | Info |
Sources: Siemens Industry Support
If you want to establish Modbus communication with a Siemens controller,
you will find some useful information here.
Client and server interfaces can be implemented with Modbus TCP and RTU.
For this purpose, the blocks MB_CLIENT and MB_SERVER are available for Modbus TCP,
and Modbus_Master, Modbus_Slave, and Modbus_Comm_Load for Modbus RTU.
The MB_SERVER block provides a Modbus server very easily.
Only a data block for data exchange (reading and writing) needs to be provided.
If a connection exists, any additional connection will be rejected.
The only option is to start another server on a different IP port.
The MB_CLIENT block is used for this.
Each block provides "Detailed status information of the instruction" via the STATUS output.
In practice, this is not quite so simple, because the blocks internally use additional blocks.
MB_SERVER: TCON, TSEND, TRCV, TDIAG, TRESET, TDISCON, TDIAG_Status
MB_CLIENT: TCON, TDISCON, TSEND, TRECEIVE, TRESET, TDIAG, TDIAG_Status
Therefore, depending on the problem, the STATUS values of these blocks are also returned!
The meaning of the error codes can be found in the documentation of the corresponding communication instruction.
If a communication error occurs when sending or receiving data (80C4 (Temporary communications
error. The specified connection is temporarily down.), 80C5 (Remote partner closed connection actively.), 80A1
(The specified connection is disconnected or is not yet established.)), the existing connection
is terminated.
This also means that you will see all STATUS values returned during connection termination, and only
after the connection has been terminated will the STATUS code be output that indicates the cause of the
connection termination.
Example: If a temporary communication error occurs when receiving data, STATUS
7003 (ERROR=false) is output first and then 80C4 (ERROR=true).
| STATUS (hex) |
Description |
|---|---|
| 0000 | Instruction executed without errors |
| 0001 | Connection established |
| 0003 | Connection termination completed |
| 7000 | No job active and no connection established (REQ=0, DISCONNECT=1) |
| 7001 | Connection establishment initiated |
| 7002 | Intermediate call, connection is being established |
| 7003 | Connection is being terminated |
| 7004 | Connection established and monitored, no job processing active |
| 7005 | Data is being sent |
| 7006 | Data is being received |
Here, the additional problem is that the cause may be local or at the remote endpoint.
| STATUS (hex) |
local / remote |
Modbus Exception |
Description |
|---|---|---|---|
| 80C8 | local | - | No response from the server within the defined time period. Check the connection to the Modbus server. This error is only reported after the configured retry attempts have been completed. If the "MB_CLIENT" instruction does not receive a response with the originally transmitted transaction ID (see static variable MB_TRANSACTION_ID) within the defined time period, this error code is output. |
| 8380 | local | - | The received Modbus frame does not have the correct format, or too few bytes were received. |
| 8381 | remote | 01 | Function code is not supported. |
| 8382 | local | - |
|
| 8382 | remote | 03 | Invalid length specification in the received Modbus frame. Check the server side. |
| 8383 | local | - | Error reading or writing the data, or access outside the address range of MB_DATA_PTR. |
| 8383 | remote | 02 | Error reading or writing the data, or access outside the server address range. |
| 8384 | local | - |
Invalid exception code received.
|
| 8384 | remote | 03 | Error in the data value for function 5. |
| 8385 | local | - |
|
| 8385 | remote | 03 | Diagnostic code not supported |
| 8386 | local | - | Received function code does not match the one originally sent. |
| 8387 | local | - | The protocol ID of the Modbus TCP frame received from the server is not equal to "0". |
| 8388 | local | - | The Modbus server sent a different data length than requested. This error occurs only when using Modbus functions 5, 6, 15, or 16. |
| STATUS (hex) |
Description |
|---|---|
| 80B6 | Invalid connection type, only TCP connections are supported. |
| 80BB | Invalid value for parameter ActiveEstablished (identifier for the type of connection establishment, see parameter CONNECT (S7-1200, S7-1500)):
|
| 8188 | Invalid value for parameter MB_MODE. |
| 8189 | Invalid addressing of the data in parameter MB_DATA_ADDR. |
| 818A | Invalid data length in parameter MB_DATA_LEN. |
| 818B | Invalid pointer in parameter MB_DATA_PTR. Also check the values of parameters MB_DATA_ADDR and MB_DATA_LEN. |
| 818C | Time error in parameter BLOCKED_PROC_TIMEOUT or RCV_TIMEOUT (see static variables of the instruction). BLOCKED_PROC_TIMEOUT and RCV_TIMEOUT must be between 0.5 s and 55 s. |
| 8200 |
|
| ERROR | STATUS (hex) |
Description |
|---|---|---|
| 0 | 0000 | Send job completed without errors. |
| 0 | 0001 | Communication connection established. |
| 0 | 0003 | Communication connection established. |
| 0 | 7000 | No send job processing active, no communication connection established. |
| 0 | 7001 | First call when establishing a connection. |
| 0 | 7002 | Connection is currently being established (REQ irrelevant) |
| 0 | 7003 | Communication connection is being terminated. |
| 0 | 7004 | Communication connection is established and monitored. No send job processing active. |
| 0 | 7005 | Sending data in progress. |
| 1 | 80A1 |
|
| 1 | 80A3 | The subordinate T_DIAG instruction reported that the connection was terminated. |
| 1 | 80A4 | The IP address of the remote endpoint of the connection is invalid, or it matches the IP address of the local partner. |
| 1 | 80A7 | Communication error: You called the instruction with COM_RST = 1 before the send job was completed. |
| 1 | 80AA | A connection establishment with the same connection ID is currently in progress by another block. Please repeat the job with another positive edge at parameter REQ. |
| 1 | 80B3 |
|
| 1 | 80B4 |
When using protocol variant ISO on TCP (connection_type = B#16#12) for passive connection establishment (active_est = FALSE), one or both of the following conditions were violated:
|
| 1 | 80B5 | For connection type 13 = UDP, only passive connection establishment is permitted. |
| 1 | 80B6 | Parameterization error in parameter connection_type of the data block for the connection description. |
| 1 | 80B7 |
|
| 1 | 8085 | Parameter LEN is greater than the maximum permitted value. |
| 1 | 8086 | The parameter ID within parameter CONNECT is outside the permitted range. |
| 1 | 8087 | Maximum number of connections reached, no further connection possible. |
| 1 | 8088 | The value at parameter LEN does not match the receive area specified at parameter DATA. |
| 1 | 8089 |
|
| 1 | 8091 | Maximum nesting depth exceeded. |
| 1 | 809A | The parameter CONNECT points to a field that does not match the length of the connection description. |
| 1 | 809B |
InterfaceID is invalid:
|
| 1 | 80C3 |
|
| 1 | 80C4 |
Temporary communication error:
|
| 1 | 80C5 |
|
| 1 | 80C6 |
Network error:
|
| 1 | 8189 | Invalid data address: Select a suitable value for the data address at the DATA_ADDR parameter. See description Modbus_Master (Page 125) in the Info system. |
| 1 | 818A | Invalid length |
| 1 | 818B | Invalid value for DATA_PTR |
| 1 | 818C | Interconnection error of the DATA_PTR parameter |
| 1 | 818D | The area addressed by DATA_PTR is longer than the DB, or the area addressed is too small for the number of data bytes to be read or written. |
| 1 | 8280 | Negative acknowledgment when reading module |
| 1 | 8281 | Negative acknowledgment when writing module |
| 1 | 8722 | Parameter CONNECT: Source area is invalid. The area does not exist in the DB. |
| 1 | 873A | Parameter CONNECT: Access to the connection description is not possible (e.g. because the DB is not available). |
| 1 | 877F | Parameter CONNECT: Internal error. |
| 1 | 8822 | Parameter DATA: Source area invalid, area does not exist in DB. |
| 1 | 8824 | Parameter DATA: Area error in the VARIANT pointer. |
| 1 | 8832 | Parameter DATA: DB number is too large. |
| 1 | 883A | Parameter DATA: No access to the data area, for example because the data block does not exist. |
| 1 | 887F | Parameter DATA: Internal error, e.g. invalid VARIANT reference. |
| 1 | 893A | Parameter ADDR: Access to the send area is not possible (e.g. because the DB is not available). |