Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

10.25-29 Chongqing Suzhou No Tin Siemens S7-1200/1500 PLC TIA Technology Practical Class Enrollment Open

Modbus RTU Communication

Discussion on Modbus RTU Communication

In modern highly integrated industries, communication between PLCs is frequently used. Common communication protocols include Modbus, Profibus DP, Profinet, CANOPEN, etc. Today, we will explain how two PLCs communicate using Modbus RTU on the Siemens TIA Portal platform.

Before establishing communication, we must meet the following software and hardware requirements:

  • 1. A computer with TIA V16 Portal software installed;

  • 2. Two Siemens PLCs that must support TIA V16 version;

  • 3. One DP9 pin male connector (used for 1200), one DP15 pin male connector (used for 1500), and a two-core shielded cable (specification 0.5 square);

  • 4. The communication module specifications used in today’s experiment are as follows:

CM1241RS422/485 Order Number: 6ES7 241-1CH320XB0;

CMPtP RS422/485HF Order Number: 6ES7 541-1AB00-0AB0;

The following images show the communication modules and DP connectors needed today;

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

1200 Communication Module

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

1500 Communication Module

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

1200 DP9 Pin Male Connector

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

1500 DB15 Pin Male Connector

Modbus wiring for 1200 and 1500:

1200 PLC Side 1500 PLC Side

3+ 11+

8- 4-

Configuration Master Station (1200 side):

1.) Create a project and add the CPU and RS485 module as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

2.) After adding the hardware, here we set the parameters of the CM1241-R485 module:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

3.) Create a DB block for the 1200 PLC side (master) to store data:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Modify the DB block “Optimize for Access”.

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

4.) Establish the required data:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

5.) Add an FC function block:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

6.) We write the program into the FB program segment and set the Modbus_Comm_Load pin parameters:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

7.) Since the Modbus_Comm_Load block defaults to RS232 mode, we need to change it to RS485 mode. There are two ways to modify it: the first is to change the “MODE” parameter from 16#00 to 16#04 in the background DB block of Modbus_Comm_Load, as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

The second method is to use the “move” instruction to send a 4 to Modbus_Comm_Load_MODE, as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Set the Modbus_Master function block pin parameters:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

8.) Testing the program:

Write to the slave 1500 Q area:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Read from the slave 1500 Q area:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Complete the master station program, then configure the slave PLC

10.) Create a project and add the CPU and communication module as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

11.) Set the PtP-RS422/485 communication module parameters as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

12. Add a global data background DB block:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

13.) Establish data storage:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

14.) We start writing the program, adding a “Modbus_comm_Load” communication initialization instruction block to the FB program segment and setting the corresponding pin parameters:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Since the “Modbus_comm_Load” function block defaults to RS232, we enable RS485, so all modifications. The first method is to directly modify Modbus_comm_Load as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

The second method is consistent with the method previously described for modifying the 1200 communication data block, as shown in the figure below:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

15. Add the slave instruction block:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

16. Testing the program:

The master station 1200 writes to the slave 1500’s Q0.0, Q0.1;

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

The slave 1500 writes to the master station 1200’s Q0.2, Q0.3, Q0.4;

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Monitor the program:

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

The above article briefly introduces the Modbus RTU communication between Siemens 1200 PLC and Siemens 1500 PLC. After real machine testing, the read and write operations are correct. Due to time constraints and limited expertise, the article may not be clear or may even contain errors. Please feel free to leave comments for discussion!

Testing Modbus RTU Communication Between Siemens PLC 1200 and 1500

Leave a Comment