S7-SoftPLC:Modbus TCP configuration

From IBHsoftec Wiki English
Jump to: navigation, search

This driver allows to connect local I/O with the S7-SoftPLC via Ethernet / Modbus TCP. The driver supports the Modbus TCP function codes listed in the chart below. If a slave is supposed to run with the S7-SoftPLC, it should be verified, that it supports the listed Modbus functions. If possible the Modbus function Read/Write Registers (0x17) should be used, since it executes reading and writing in one frame. If a slave does not support this funciton, it has to be created as two slaves. The first configuration reads the inputs, the second writes the outputs. Since this isn't very efficient, the function Read/Write should be preferred. Additionally the driver installs a Status SFC/FC, to monitor the status of the Modbus TCP connection.

Status SFC/FC

CALL SFC/FC 193
IN0  := 1 //INPUT INT
RET_VAL  := MW 0 //RESULT INT
OUT1  := MW 2 //OUTPUT INT
OUT2  := MW 4 //OUTPUT DWORD
OUT3  := MW 8 //OUTPUT INT
OUT4  := MW 10 //OUTPUT DWORD

Parameter Type of Data Description
IN0 INT Slave number format: 0,1,2,3,...this corresponds to the slave index number, as configured
RET_VAL INT Returns 0 if a parametrisation does exist.

Otherwise 0x8090 Sonst 0x8090

OUT1 INT Bit 0 = 1 connection established

Bit 1 = 1 Error

Bit 2...7 reserved

Bit 8...15 PLC cycles since last I/O module answer (resetted by Status SFC/FC)

OUT2 DWORD Parametrised IP address
OUT3 INT Parametrised port
OUT4 DWORD Windows-Error-Code

Most important Windows(32-Bit) network-error messages

0x271D / 10013d Permission denied – Indicates restricted rights or a firewall.
0x2745 / 10053d Software caused connection abort – Probably defective network connection or no slave available at given address.
0x2746 / 10054d Connection reset by peer. The slave has disconnected the connection.
0x274C / 10060d Connection timed out. Timeout on network connection.
0x274D / 10061d Connection refused. The slave (or a router in-between) has refused the connection.
0x2751 / 10065d No route to host. The connection to the aimed network can not be established. Network settings and gateway/router settings have to be checked.

Status word

If successful the BR of the status word is set, OR, STA and /FC are zero.

If failed the BR, OR, STA and /FC of the status word are zero.