Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Modbus RTU Communication

Overview of Modbus RTU Communication

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

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

  • 1. A computer with TIA V16 Portal software;

  • 2. Two Siemens series PLCs, must be compatible with TIA Portal V16;

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

  • 4. The communication module model specifications for today’s experiment are as follows:

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

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

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

1200 side communication module

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

1500 side communication module

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

DP9 pin male connector for 1200

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

DB15 pin male connector for 1500

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:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

2.) Hardware setup is complete; we will set the parameters for the CM1241-R485 module:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

3.) Create a DB block for storing data for the 1200 PLC (master station):

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Modify the DB block for “optimized access”.

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

4.) Create the required data:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

5.) Add an FC function block:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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 in the Modbus_Comm_Load background DB block from 16#00 to 16#04 as shown below:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

The second method is to use the “move” instruction to pass a 4 to Modbus_Comm_Load_MODE as shown below:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Set the pin parameters for the Modbus_Master function block:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

8.) Test the program:

Write to the slave 1500 Q area:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Read from the slave 1500 Q area:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Complete the master station program, then configure the slave PLC:

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

12.) Add a global data background DB block:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

13.) Create storage data:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Since the “Modbus_comm_Load” function block defaults to RS232, and we enable RS485, modifications are necessary. The first method is to directly modify Modbus_comm_Load as shown below:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

The second method is consistent with the previous modification of the 1200 communication data block as shown below:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

15. Add the slave instruction block:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

16. Test the program:

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Monitor the program:

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

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, there may be unclear or incorrect information in the article. Please feel free to leave comments for discussion!

Disclaimer: This article is reproduced from the internet, and the copyright belongs to the original author. If there are any copyright issues, please contact us for deletion. Thank you!

Siemens PLC 1200 and 1500 Modbus RTU Communication TestSiemens PLC 1200 and 1500 Modbus RTU Communication TestSiemens PLC 1200 and 1500 Modbus RTU Communication Test

[Siemens Example Program]

Siemens PLC 1200 and 1500 Modbus RTU Communication Test

Leave a Comment