Hello everyone, I am Maple Leaf, and I have been in the PLC industry for over twenty years. Today, let’s talk about something practical—PLC communication essentials. To be honest, communication issues in the field are the most common type of faults I encounter, without exception! Many novice engineers have stumbled in this area, including myself back in the day.
RS-485: The Veteran of Communication
First, let’s talk about RS-485, this “old relic” that is still active in industrial sites today. Why? Firstly, it has strong anti-interference capabilities, and secondly, the wiring is simple—just two wires are enough.
Last year, I visited a water plant where the RS-485 network installed over a decade ago was still running stably, without any changes. I was impressed by its durability!
Practical Tips:
- 120-ohm termination resistors must be added at both ends of the 485 bus; this is not optional, it is mandatory!
- If the communication distance exceeds 100 meters, the signal will attenuate, so remember to add a repeater.
// Typical Modbus RTU master reading slave example code (Siemens S7-200)
// Read registers 40001-40002 of the device with slave address 1
MOVB 16#01, VB0 // Slave address
MOVB 16#03, VB1 // Function code: read holding registers
MOVW 0, VW2 // Starting address high byte
MOVW 0, VW4 // Starting address low byte
MOVW 0, VW6 // Register count high byte
MOVW 2, VW8 // Register count low byte
I once encountered a ridiculous fault: a customer reported that the device communication kept dropping. Upon investigation, it turned out that he had connected the termination resistor as 1.2K ohms (mistaking 120 ohms for 1.2K). This one-character difference caused two days of hassle!
PROFIBUS-DP: The German Industrial Standard
Speaking of PROFIBUS, it is Siemens’ forte. The transmission speed can reach up to 12 Mbps, which is significantly higher than RS-485.
Practical Experience:
- The biggest fear in a DP network is loose connections; testing continuity with a multimeter can save a lot of trouble.
- Each segment can have a maximum of 32 stations; if exceeded, a repeater must be added.
- Use dedicated purple DP cables; don’t skimp on costs by using ordinary cables, as it can lead to endless problems.
// S7-300/400 PROFIBUS master configuration example
CALL "DP_SEND"
IOID := B#16#54 // Peripheral I/O
LADDR := W#16#100 // Starting address
RECORD := P#DB10.DBX0.0 BYTE 20 // Sending data area
RET_VAL := MW100 // Return value
I remember once at an automotive plant, the entire production line’s PROFIBUS network kept dropping stations. After searching everywhere, I found that the installation workers had bundled the DP cables with the power cables for aesthetics. I was furious: bundling high voltage and low voltage together is just asking for trouble!
PROFINET/Ethernet: The Future of Industrial Communication
In recent years, Ethernet communication has become mainstream, especially PROFINET, which can achieve transmission speeds of up to 100 Mbps and supports real-time control.
Practical Tips:
- Industrial Ethernet switches must be managed; don’t be tempted by cheaper options.
- Try to use a star topology for the network to avoid loops.
- Use shielded cables for Ethernet inside electrical cabinets; for long distances outside, consider using fiber optics.
// S7-1200/1500 PROFINET communication code example
"Send Data Block"(
REQ := "Send Trigger Bit",
ID := 1, // Connection ID
LEN := 20, // Send length
DONE := "Send Complete Bit",
ERROR := "Send Error Bit",
STATUS := "Status Word",
DATA := "Send Data Area"
);
I had a rather amusing case: a customer’s PROFINET network was intermittently dropping. After checking all devices, I still couldn’t resolve the issue. Finally, I had a brainwave and checked the switch’s IP, discovering it was in the same subnet as their office network! It turned out that the office computers were periodically scanning the entire subnet, causing the disruptions. This taught us that industrial networks and office networks must be isolated!
OPC UA: The Tool to Break Down “Data Silos”
When it comes to data integration, we cannot overlook OPC UA. It acts as a “translator” between various automation devices, allowing Mitsubishi and Siemens to communicate smoothly.
Getting Started Tips:
- When configuring the OPC server, do not set the communication timeout parameter too short; in a production environment, it is recommended to set it above 500ms.
- Do not skip security settings; ensure encryption where necessary and authentication where required.
Two years ago, I implemented a data acquisition system in a large chemical plant, integrating data from over 20 different brands of PLCs through OPC UA for unified monitoring. The customer was thrilled, saying, “Previously, it was like having 20 mute people; now they can all speak the same language!”
Three Key Steps to Solve Communication Issues
After many years of projects, I have summarized the “three key steps” to solve communication problems:
- Check the Physical Layer: 90% of communication issues arise here! Check cables, connectors, termination resistors, and power supply.
- Verify Parameters: Baud rate, station number, and data format must be consistent; if one is incorrect, communication will fail.
- Packet Capture Analysis: If the problem is still elusive, use packet capture tools (like Wireshark) to analyze communication data; this is a powerful technique.
Finally, I have a practical suggestion: when working on projects, always leave room in the communication plan. I have seen too many projects that required changes later due to insufficient communication bandwidth, leading to costly rewiring and equipment replacement.
I hope these practical experiences can help you avoid detours. Feel free to discuss any questions in the comments; Maple Leaf is always here to help!
Next time: “PLC Program Structure Design: How to Write Code That Won’t Make Your Colleagues Want to Curse,” don’t forget to follow!