Articles on: Learning & FAQ

Communication Application of Siemens S7-1200PLC and T6 Modbus RTU

This article introduces the communication application of Modbus RTU between Siemens S7-1200PLC and T6.

Hardware

S7-1200PLC: CPU 1215C DC/CD/DC
CM1241: RS422/485
T6: T6-1000RS, T6M80-1000H2A3-M17S
24V power supply: S-150-24

Function description:

S7-1200 PLC serves as the Modbus RTU master station, and the T6 driver serves as the slave station. PLC reads the motor position parameters of T6.

Function realization:

Step 1: T6 driver parameter setting
Pr5.29 = 4Parity: None, Data bits: 8, Stop bits: 1
Pr5.30 = 6Baud rate: 115200
Pr5.31 = 1RS485 slave address is 1

Step 2: configure the Modbus RTU communication module


Step 3: Enable system memory

Select PLC_1 in the project tree, left-click "Properties", find "System and Clock Memory" in the pop-up window, and check Enable System Memory Bytes.


Step 4: call the MB_COMM_LOAD instruction

Open the Main (OB1) organization block, open "Instructions" → "Communication" → "Communication Processor" → "Modbus", and drag MB_COMM_LOAD into the program segment, as shown in the figure.


Step 5: Create data sending and receiving buffer areas

In the project tree, select "Add New Block" → "DB Data Block" → "OK", as shown in the figure. After adding a new block, you need to remove the "Optimized Block Access" option and add data sending and receiving caches. district.


Step 6: Call the MB_MASTER instruction

Open the Main (OB1) organization block, open "Instructions" → "Communication" → "Communication Processor" → "Modbus" in order, and drag MB_MASTER into the program segment, as shown in the figure:


In this command, the MB_ADDR slave address is selected as 1 and the MODE mode is selected as 0, indicating that the master station is in read mode. The starting address of DATA_ADDR is 424620, which is the RS485 communication for reading Pr8.43 (motor position) and Pr8.43 (motor position). Address 0X602B, converted to decimal is 24619, 24619+400001=424620.
Step 7: Run the program and read Pr8.43

In the PLC program, the received data is 0X1A9D, which is converted into decimal 6813. Check Pr8.43=6813 on T6 to prove that the data is read correctly.

Summary

This program is a simple case of Modbus RTU communication between Siemens S7-1200 and T6 driver. It provides a method for Modbus RTU communication between S7-1200 and T6. It has reference value for the communication between other drivers and S7-1200.

Updated on: 31/10/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!