Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

Click the blue text to follow us

Sometimes we are concerned about too many public account messages and miss some of the messages we like, and cannot see the push from the Industrial Control Forum in time. We can star or pin the public account. How to star and pin? 【Open an article from the Industrial Control Forum public account, click the blue font below the article title to enter the Industrial Control Forum public account, select set as star at the top right corner “···”, 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 with FX3U-485-BD and FX3U-485ADP-MB expansion and several temperature acquisition modules to realize Modbus communication to collect 10 temperature signals on site. The upper computer of the first phase uses C#.NET and the PLC programming port to implement programming port protocol communication to display the real-time measurement values of 10 temperature channels 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 Port1 communication port to implement PPI protocol communication to display the real-time measurement values of the second phase temperature and other data monitoring. The Port0 of the PLC communicates with Delta VFD-M series inverters to realize Modbus RTU protocol communication.

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

Two

Siemens S7-200 Communication Programming:

The communication parameters of the Siemens S7-200 Port0 communication port are agreed to be 9600, 8, E, 1, the communication protocol is Modbus RTU master station, the physical layer of communication is RS485, and the communication function is to periodically read the input registers of the 10 slaves, with the agreed slave address of 0x01, function code of 0x04, starting address of the registers of 0x0000, and the number of registers to be read of 0x000a, which means that the Siemens S7-200 Port0 communication port will periodically send the command 01 04 00 00 00 0A 70 0D. Assuming the current 10 temperature values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 degrees, the Mitsubishi FX3U extended 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 written program for the Siemens S7-200 Port0 Modbus RTU master station is as follows:

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 Port0 communication port sends the command 01 04 00 00 00 0A 70 0D every 100ms, and the Mitsubishi FX3U extended FX3U-485-BD communication port will return the 10 temperature measurement values of its first phase in real-time according to the Modbus RTU protocol after receiving the command. The 10 temperature measurement values read by the Siemens S7-200 are finally saved to VW200, VW202, VW204, VW206, VW208, VW210, VW212, VW214, VW216, VW218 these 10 word registers.

Three

Mitsubishi FX3U Communication Programming:

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

1. The following program sets the PLC 485BD communication parameters to 9600, 8, E, 1, the communication physical layer is RS485, 8-bit data processing mode, and zeros out 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 receiving 8 bytes and sending 25 bytes in non-protocol programming communication. In the Modbus RTU protocol, the function code 0x04 master station command is fixed at 8 bytes. The master station reads the slave’s 10 input registers, and 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 stipulates the slave address, function code, and byte count in the data returned by the Mitsubishi PLC. Register D1300 is the slave address, register D1301 is the function code, and register D1302 is the byte count.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

4. The following program is the processing segment for the 01 temperature measurement value. The 01 temperature measurement value is stored in D0, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1303 and D1304, which means that D1303 and D1304 respectively save the high 8 bits and low 8 bits of D0.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

5. The following program is the processing segment for the 02 temperature measurement value. The 02 temperature measurement value is stored in D1, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1305 and D1306, which means that D1305 and D1306 respectively save the high 8 bits and low 8 bits of D1.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

6. The following program is the processing segment for the 03 temperature measurement value. The 03 temperature measurement value is stored in D2, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1307 and D1308, which means that D1307 and D1308 respectively save the high 8 bits and low 8 bits of D2.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

7. The following program is the processing segment for the 04 temperature measurement value. The 04 temperature measurement value is stored in D3, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1309 and D1310, which means that D1309 and D1310 respectively save the high 8 bits and low 8 bits of D3.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

8. The following program is the processing segment for the 05 temperature measurement value. The 05 temperature measurement value is stored in D4, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1311 and D1312, which means that D1311 and D1312 respectively save the high 8 bits and low 8 bits of D4.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

9. The following program is the processing segment for the 06 temperature measurement value. The 06 temperature measurement value is stored in D5, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1313 and D1314, which means that D1313 and D1314 respectively save the high 8 bits and low 8 bits of D5.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

10. The following program is the processing segment for the 07 temperature measurement value. The 07 temperature measurement value is stored in D6, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1315 and D1316, which means that D1315 and D1316 respectively save the high 8 bits and low 8 bits of D6.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

11. The following program is the processing segment for the 08 temperature measurement value. The 08 temperature measurement value is stored in D7, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1317 and D1318, which means that D1317 and D1318 respectively save the high 8 bits and low 8 bits of D7.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

12. The following program is the processing segment for the 09 temperature measurement value. The 09 temperature measurement value is stored in D8, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1319 and D1320, which means that D1319 and D1320 respectively save the high 8 bits and low 8 bits of D8.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

13. The following program is the processing segment for the 10 temperature measurement value. The 10 temperature measurement value is stored in D9, which is sent to the entrance parameter D1100 of subroutine P1. After calling the P1 program, the exit parameters D1101 and D1102 of subroutine P1 are sent to D1321 and D1322, which means that D1321 and D1322 respectively save the high 8 bits and low 8 bits of D9.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

14. The CRC check program command segment calculates the CRC check. Here the P0 program is called, and the entrance parameter of the P0 subroutine is D1000, which is the number of bytes participating in the CRC check, D1300 is the first data participating in the CRC check, and the exit parameters are D1001 and D1002, which are the low 8 bits and high 8 bits of the 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 receiving completion program command segment transfers the received data to D1400~D1407 after receiving completion, and then judges whether the received data meets the Modbus RTU master station command 01 04 00 00 00 0A 70 0D. If it meets, it indicates that the received command is indeed the command for the master station to read the 10 temperature measurement values. At this time, start to set M38, the rising edge of M38 sets M39, while clearing the D1400~D1407 receiving backup area, and resetting M38, receiving processing is completed.

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 indicates that D1300~D1324 stores the returned data, where D1300 is the slave address, D1301 is the function code, D1302 is the byte count, and D1303~D1322 stores the high and low 8 bits of the 10 temperature measurement values respectively, and D1323 and D1324 store the CRC check. After M39 is set, a delay starts, and when the delay time is reached, the RS instruction is started to send, and the sending is completed.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

17. The P0 subroutine function is to calculate the CRC check, occupying resources: M0-M15, M16, M17, M18, V0, Z0, the entrance parameter is D1000, which is the number of bytes participating in the CRC check, D1300 is the first data participating in the CRC check, and the exit parameters are D1001 and D1002, which are the low 8 bits and high 8 bits of the 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 function is to split the high and low 8 bits of a certain register, occupying resources: M20-M35, the entrance parameter is 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 01 04 00 00 00 0A 70 0D command, and the Mitsubishi PLC returns 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 command after receiving the command. After analysis, the sending is correct and the return is correct, and the Mitsubishi PLC program is correct.

Implementing Modbus RTU Slave with Mitsubishi FX3U Using RS Instruction Programming

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

3. System joint debugging: The Port0 communication port of the Siemens PLC and the Mitsubishi FX3U-485-BD hardware are connected, running the Mitsubishi PLC, and then running the Siemens PLC. As a result, it can be read in real-time in VW200~VW218 of Siemens PLC to the 10 temperature measurement values of D0~D9 of Mitsubishi PLC, and the communication is successful.

Source/China Industrial Control Network, please contact for reprint

Previous Recommendations

【Original Share】 ET200 series 1510SP 1PN communication using CM ptp module
【Original Share】PLC system flow accumulation method reference
【Original Share】In the era of the Internet of Things, will the automation pyramid be replaced?
Mitsubishi PLC programming application examples sharing, beginners’ fast track
【Original Share】Cigarette factory packaging machine rubber roller modification electronic gear control exploration
Practical! Complete wiring diagram of Siemens S7-1200 series PLC
How do beginners learn PLC to do projects with automation engineers?
Common PLC programming wiring diagrams and ladder diagram programs
Do you understand the design process of electrical control cabinets? Recommended to collect
Analysis of three-phase four-wire and three-phase five-wire systems, many people misunderstand!
【Share】Advantages and disadvantages of communication and hardwired signal exchange
【Original Share】A paper teaches you to master cascade PID adjustment control
Share classic PLC program examples~
【Original Share】Even beginners can DIY IoT systems, program design is here!
【Original Share】Quick inspection method of PLC control circuit (taking hydraulic maintenance as an example)
【Original Share】Siemens S7-200 Smart and Omron CP1H-E achieve Modbus TCP Ethernet communication
【Original Share】Schneider HMIGXU5512 and S7-200 SMART Ethernet communication
【Organized Share】EPLAN beginner materials, EPLAN tables and symbol libraries summary
【Original Share】Three-phase load imbalance, is connecting the neutral wire harmful or beneficial?
【Step-by-step explanation】Siemens PLC PID configuration settings and common PID problem answers
【Original Share】Talking about the difficult development path of domestic pressure sensors
【Organized Share】Electric motors, magnetic fields, direct and alternating circuits, electrical calculation formulas大全, a must-have for electricians!
【Original Recruitment】The growth path of industrial control technology cowpeople, have had these moments!
【Original Share】Reinterpreting the classic PID controller from a new perspective
【Original Share】I have been doing inverters for 15 years, let me explain the output short circuit protection function of inverters
【Original Share】Is PLC ladder diagram programming low? Then you must take a look at the origin of PLC ladder diagrams
【Original Share】How to establish OPC communication with 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

×