Eng.
BOUZID Osema
PLC communication via Modbus TCP/IP
Communication between S7-1500 PLC and S7-1200
Communication via Modbus TCP/IP
Client “S7-1500” Server “S7-1200”
OSI Model & Modbus
Modbus TCP/IP Modbus RTU
Modbus Application Layer Modbus Application Layer
TCP
IP
MAC Master / Slave
Ethernet physical Layer RS-232 , RS-485
Modbus Mode
Modbus Mode
Modbus Mode
Modbus Mode
Eng. BOUZID Osema
TIA Portal
Programming and configuration in the TIA portal
Configuring Communication S7-1200
Enable the use of clock memory byte
Configuration of Client ( S7-1500 PLC)
In the TIA Portal, after selecting the CPU S7-1500 and the CPU S7-1200, click on the Porfinet port to
create a channel between the S7-1500 and the S7-1200.
S7-1500
Put IP address of S7-1500 PLC (192.168.0.4)
Program blocks (Client)
Create DB of write_db
Proprities DB ”write_db” -> Disable optimized block access -> Ok
CONNECT ( Client )
The following structures (system data types) can be used:
TCON IP v4: Includes all address parameters that are required for establishing a programmed connection.
1 - InterfacelD :- Hardware identifier of the local interface (value range: 0 to 65535).
2 - ID Reference to this connection (value range: 1 to 4095).
3 - Connection Type Select 11 (decimal) for TCP
4 - Active Establishe ID for the manner in which the connection is established
Select TRUE for active connection establishment (Client Write data to Server)
5 - Remote Address IP address of the connection partner (Modbus server).
6 - Remote Port Port number of the remote connection partner (value range: 1 to 49151). the TCP/IP
protocol (default value: 502).
7 - Local Port Port number of the local connection partner: Any port: "0
Program blocks (Client)
Create DB of connection Cleint
Proprities DB ”connect_Client” -> Disable optimized block access -> Ok
TIA Portal
Main OB
Netw : MB_CILENT
REQ : Activate transmission
DIS CONNECT : Disable communication
MB_MODE : Modbus Mode 0 = Read , 1 = Write , ... (page 5 )
MB_DATA_ADDR : Modbus Data Addresse (page 5)
MB_DATA_LEN : طول البيانات
MB_DATA_PIR : (page 11) )Read هوMb_Mode ) أو كتلة البيانات التي يرسلها الخادم إىل العميل (إذا كانWrite هوMB_Mode كتلة البيانات المنقولة إىل الخادم (إذا كان
CONNECT : DB-CONNECT Client (page 12-13)
Configuration of Server ( S7-1200 PLC)
Add Subbnet , IP Addresse (Put IP address of S7-1200 PLC (192.168.0.5) ) .
S7-1200
Program blocks (Server)
Create DB of Holding register
Proprities DB ”hold_reg” -> Disable optimized block access -> Ok
Program blocks (Server)
Create DB of connection server
Proprities DB ”connect_server” -> Disable optimized block access -> Ok
CONNECT ( Server )
The following structures (system data types) can be used:
TCON IP v4: Includes all address parameters that are required for establishing a programmed connection.
1 - InterfacelD :- Hardware identifier of the local interface (value range: 0 to 65535).
2 - ID Reference to this connection (value range: 1 to 4095).
3 - Connection Type Select 1 1 (decimal) for TCP
4 - Active Establishe ID for the manner in which the connection is established
Select TRUE for active connection establishment (Server Write data to Client)
5 - Remote Address IP address of the connection partner (Modbus client).
6 - Remote Port Port number of the remote connection partner (value range: 1 to 49151). the TCP/IP
protocol (default value: 502).
7 - Local Port Port number of the local connection partner: Any port: "0"
TIA Portal
Main OB
Netw : MB_SERVER
DISCONNECT : Disable communication
MB_HOLD_REG : Data block of the holding register which reads or writes to or from Client (Page 16)
CONNECT : DB-CONNECT Server (page 18)
Eng. BOUZID Osema
IndustriTech Nexus
AUTOMATION
T E C H N O L O G Y