Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Click the blue text to follow us

Sometimes we follow too many public account messages and miss some of the messages we like, unable to see the Industrial Control Forum’s push in time. We can star or pin the public account. So how to star and pin it? [Open an article from the Industrial Control Forum public account, click the blue text under the article title to enter the Industrial Control Forum public account, in the upper right corner “···” select set as star, pin the public account] Click the blue text to follow us

One

System Overview:

A certain workshop of Shanghai Baosteel uses the Mitsubishi FX3U series PLC to expand FX3U-485-BD and FX3U-485ADP-MB along with several temperature collection modules to realize Modbus communication and collect 10 temperature signals on site. The upper computer of the first phase uses C#.NET and the PLC programming port to achieve programming port protocol communication to display the real-time measurement values of 10 temperature readings and other data monitoring.

The second phase of the equipment controller uses Siemens S7-200 series PLC, where the upper computer of the second phase uses C#.NET and the PLC’s Port1 communication port to achieve PPI protocol communication to display the real-time measurement values of the second phase temperature and other data monitoring. The PLC’s Port0 port and Delta VFD-M series inverter achieve Modbus RTU protocol communication.

Now it is required that the second phase must simultaneously collect the 10 temperature measurement values of the first phase. Since the second phase controller Siemens S7-200’s Port0 has already established Modbus RTU master station communication with the Delta VFD-M inverter, the first phase controller Mitsubishi FX3U can only use FX3U-485-BD communication hardware, and the software uses RS instruction without protocol programming to implement Modbus RTU slave.

Two

Siemens S7-200 Communication Programming:

The communication parameters of Siemens S7-200’s Port0 communication port are agreed to be 9600, 8, E, 1, the communication protocol is Modbus RTU master station, and the communication physical layer is RS485. The communication function is to periodically read the 10 input registers of the slave, with the agreed slave address being 0x01, function code being 0x04, starting register address being 0x0000, and the number of registers to pre-read being 0x000a. This means that the Siemens S7-200’s Port0 communication port will periodically send the command 01 04 00 00 00 0A 70 0D. Assuming the current 10 temperature readings are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 degrees, the Mitsubishi FX3U expanded FX3U-485-BD communication port will return the following data after receiving the above command: 01 04 14 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 0A B9 F0

The program for the Modbus RTU master station on Siemens S7-200’s Port0 is shown below:

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

The Siemens S7-200’s Port0 communication port sends the command 01 04 00 00 00 0A 70 0D every 100ms, and the Mitsubishi FX3U expanded FX3U-485-BD communication port will return the 10 temperature measurement values in real-time according to the Modbus RTU protocol after receiving the command. The 10 temperature measurement values read by the Siemens S7-200 will be saved in VW200, VW202, VW204, VW206, VW208, VW210, VW212, VW214, VW216, and VW218, these 10 word registers.

Three

Mitsubishi FX3U Communication Programming:

The communication parameters of the Mitsubishi FX3U expanded FX3U-485-BD communication port are agreed to be 9600, 8, E, 1, the communication protocol is Modbus RTU slave, and the communication physical layer is RS485. The function is to return the 10 temperature measurement values in real-time according to the Modbus RTU protocol after receiving the command from the Modbus RTU master station of Siemens S7-200. The 10 temperature measurement values are stored in registers D0 to D9, and programming is implemented through RS instruction without protocol. Due to space limitations, only a detailed explanation of the Mitsubishi FX3U without protocol programming is provided below.

1. The following program sets the PLC’s 485BD communication parameters to 9600, 8, E, 1, the communication physical layer is RS485, 8-bit data processing mode, and clears the relevant registers and relays.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

2. The following is the RS instruction program segment, which stipulates that 8 bytes are received and 25 bytes are sent in the communication without protocol. In the Modbus RTU protocol, the 0x04 function code master station command is fixed at 8 bytes, and the master station reads the 10 input registers of the slave. According to the Modbus RTU protocol, the number of bytes returned by the slave is 10*2+5=25 bytes.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

3. The following program specifies the slave address, function code, and byte count in the returned data from the Mitsubishi PLC. Register D1300 is the slave address, D1301 is the function code, and D1302 is the byte count.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

4. The following program handles the first temperature measurement value. The first temperature measurement value is stored in D0, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1303 and D1304, which means D1303 and D1304 store the high and low 8 bits of D0 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

5. The following program handles the second temperature measurement value. The second temperature measurement value is stored in D1, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1305 and D1306, which means D1305 and D1306 store the high and low 8 bits of D1 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

6. The following program handles the third temperature measurement value. The third temperature measurement value is stored in D2, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1307 and D1308, which means D1307 and D1308 store the high and low 8 bits of D2 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

7. The following program handles the fourth temperature measurement value. The fourth temperature measurement value is stored in D3, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1309 and D1310, which means D1309 and D1310 store the high and low 8 bits of D3 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

8. The following program handles the fifth temperature measurement value. The fifth temperature measurement value is stored in D4, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1311 and D1312, which means D1311 and D1312 store the high and low 8 bits of D4 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

9. The following program handles the sixth temperature measurement value. The sixth temperature measurement value is stored in D5, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1313 and D1314, which means D1313 and D1314 store the high and low 8 bits of D5 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

10. The following program handles the seventh temperature measurement value. The seventh temperature measurement value is stored in D6, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1315 and D1316, which means D1315 and D1316 store the high and low 8 bits of D6 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

11. The following program handles the eighth temperature measurement value. The eighth temperature measurement value is stored in D7, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1317 and D1318, which means D1317 and D1318 store the high and low 8 bits of D7 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

12. The following program handles the ninth temperature measurement value. The ninth temperature measurement value is stored in D8, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1319 and D1320, which means D1319 and D1320 store the high and low 8 bits of D8 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

13. The following program handles the tenth temperature measurement value. The tenth temperature measurement value is stored in D9, which is sent to the P1 subroutine’s entry parameter D1100. After calling the P1 program, the exit parameters D1101 and D1102 of the P1 subroutine are sent to D1321 and D1322, which means D1321 and D1322 store the high and low 8 bits of D9 respectively.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

14. The CRC check program command segment is here calling the P0 program, the P0 subroutine’s entry parameter is D1000, which is the number of bytes participating in CRC check, D1300 is the first participating data for CRC check, and the exit parameters are D1001 and D1002, which are the low and high 8 bits of CRC check, and the final CRC check is sent to D1323 and D1324.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

15. The receive completion program command segment transfers the received data to D1400~D1407 after receiving is complete. It then checks if the received data meets the Modbus RTU master station command 01 04 00 00 00 0A 70 0D. If it does, it indicates that the received command is indeed the master station reading the command for the 10 temperature measurement values. At this point, M38 is set, M38 rising edge sets M39, while clearing the D1400~D1407 receive storage area and resetting M38, completing the receive processing.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

16. The start sending program command segment shows that D1300~D1324 save the returned data, where D1300 is the slave address, D1301 is the function code, D1302 is the byte count, D1303~D1322 save the high and low 8 bits of the 10 temperature measurement values, and D1323 and D1324 save the CRC check. After M39 is set, a delay starts, and when the delay time is reached, the RS instruction is sent to start sending, completing the sending.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

17. The P0 subroutine’s function is to calculate the CRC check, occupying resources: M0-M15, M16, M17, M18, V0, Z0, with the entry parameter being D1000, which is the number of bytes participating in CRC check, D1300 is the first participating data for CRC check, and the exit parameters are D1001 and D1002, which are the low and high 8 bits of CRC check, and the final CRC check is sent to D1323 and D1324.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

18. The P1 subroutine’s function is to split the high and low 8 bits of a certain register, occupying resources: M20-M35, with the entry parameter being D1100, which is the register to be split, and the exit parameters are D1101 and D1102, which are the high and low 8 bits of the split register.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Four

Communication Program Testing:

1. Mitsubishi PLC communication program testing: The serial port debugging assistant sends the command 01 04 00 00 00 0A 70 0D, and the Mitsubishi PLC returns the command 01 04 14 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 0A B9 F0 after receiving the command. After analysis, the sending is correct, and the return is correct, indicating that the Mitsubishi PLC program is correct.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

2. Siemens PLC communication program testing: Through the serial port debugging assistant monitoring, the PLC will periodically send the command 01 04 00 00 00 0A 70 0D, indicating that the PLC sends the command correctly.

3. System joint debugging: The Siemens PLC’s Port0 communication port and Mitsubishi FX3U-485-BD hardware are connected. After running the Mitsubishi PLC, and then running the Siemens PLC, the result shows that the VW200~VW218 of the Siemens PLC can read the 10 temperature measurement values from D0~D9 of the Mitsubishi PLC in real-time, indicating successful communication.

Source/China Industrial Control Network, please contact for reprint

Previous Recommendations

【Original Sharing】 ET200 series 1510SP 1PN communication using CM ptp module
【Original Sharing】 PLC system flow accumulation method reference
【Original Sharing】 In the era of IoT, will the automation pyramid be replaced?
Mitsubishi PLC programming application case sharing, beginner’s quick start
【Original Sharing】 Exploration of electronic gear control in cigarette factory packaging machine
Practical! Complete wiring diagram of Siemens S7-1200 series PLC
How do beginners learn PLC and work on projects with automation engineers?
Common PLC programming wiring diagrams and ladder diagram programs
Do you understand the design process of electrical control cabinets? It’s recommended to collect it.
Analysis of three-phase four-wire and three-phase five-wire systems, many people misunderstand!
【Sharing】 Advantages and disadvantages of communication and hard-wired signal switching
【Original Sharing】 A comprehensive guide to mastering cascade PID control
Sharing classic PLC program examples~
【Original Sharing】 Even novices can DIY IoT systems, program design is here!
【Original Sharing】 Quick check method for PLC control circuits (taking hydraulic maintenance as an example)
【Original Sharing】 Communication between Siemens S7-200 Smart and Omron CP1H-E via Modbus TCP Ethernet
【Original Sharing】 Schneider HMIGXU5512 and S7-200 SMART Ethernet communication
【Organized Sharing】 EPLAN beginner materials, EPLAN tables, and symbol library collection
【Original Sharing】 The difficult development path of domestic pressure sensors
【Organized Sharing】 Electric motor, magnetic field, direct and alternating current circuits, electrical calculation formulas, a must-have for electricians!
【Original Call for Contributions】 The growth path of industrial control technology experts, everyone has had these moments!
【Original Sharing】 A new perspective on interpreting the classic PID controller
【Original Sharing】 Having worked with inverters for 15 years, interpreting the output short circuit protection function of inverters
【Original Sharing】 Is PLC ladder diagram programming low? Then you must see the origin of PLC ladder diagrams
【Original Sharing】 How to establish OPC communication between WINCC7.3 and 1200?
Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Share the ball

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Like the ball

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Watching the ball

Leave a Comment