Communication Application Between Siemens S7-1200 PLC and A6 Modbus RTU
In order to facilitate successful communication between your PLC and STEPPERONLINE's servo motor, this article takes Siemens S7-1200 PLC as an example to demonstrate in detail the communication application between the A6-RS series Modbus RTU and PLC.
Assumption scenario: S7-1200 PLC serves as the Modbus RTU master station, and the A6-RS driver serves as the slave station. Read the DC bus voltage of the driver.
First, prepare the following items:
S7-1200PLC: CPU 1215C DC/CD/DC;
Any servo motor in the A6-RS series;
A RS485 network cable;
The specific operation method is as follows:
Set driver parameters for A6-RS
Configuring the Modbus RTU communication module
Enable system nemory
Select PLC_1 in the project tree, left-click "Properties", find "System and clock memory" in the pop-up window, and check "Enable the use of system memory byte".
Call the MB_COMM_LOAD instruction
Open the Main (OB1) block, open "Instructions" → "Communication" → "Communication Processor" → "Modbus" in order, and drag MB_COMM_LOAD into the program segment, as shown in the figure:
Create data sending and receiving buffers
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 buffer areas..
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 instruction, 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 16# 4006, which is to read U40.06 (DC bus voltage), no need for +40001 or 400001
Run program
Read U40.06 in the PLC program. After receiving the data, convert it into decimal. Compare it with U40.06 on the A6-RS to check whether the read data is correct.
Assumption scenario: S7-1200 PLC serves as the Modbus RTU master station, and the A6-RS driver serves as the slave station. Read the DC bus voltage of the driver.
First, prepare the following items:
S7-1200PLC: CPU 1215C DC/CD/DC;
Any servo motor in the A6-RS series;
A RS485 network cable;
The specific operation method is as follows:
Set driver parameters for A6-RS
Parameters Setting | Description |
---|---|
C0A.00=1 | Modbus communication station number |
C0A.01=7 | Modbus communication baud rate |
C0A.02=0 | Modbus communication format |
Configuring the Modbus RTU communication module
Enable system nemory
Select PLC_1 in the project tree, left-click "Properties", find "System and clock memory" in the pop-up window, and check "Enable the use of system memory byte".
Call the MB_COMM_LOAD instruction
Open the Main (OB1) block, open "Instructions" → "Communication" → "Communication Processor" → "Modbus" in order, and drag MB_COMM_LOAD into the program segment, as shown in the figure:
Create data sending and receiving buffers
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 buffer areas..
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 instruction, 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 16# 4006, which is to read U40.06 (DC bus voltage), no need for +40001 or 400001
Run program
Read U40.06 in the PLC program. After receiving the data, convert it into decimal. Compare it with U40.06 on the A6-RS to check whether the read data is correct.
Updated on: 14/11/2024
Thank you!