
1. Basic Knowledge of PLC
A Programmable Logic Controller (PLC) is a digital computer control device specifically designed for industrial environments. It uses programmable memory to store instructions for executing logical operations, sequential control, timing, counting, and arithmetic operations, controlling various types of machinery or production processes through digital or analog input/output.
1.1 Working Principle of PLC
The working principle of a PLC is based on a scanning cycle, which mainly includes three stages: input sampling, program execution, and output refreshing. During a scanning cycle, the PLC first reads all input states, then performs logical operations based on the user program, and finally updates the output ports with the results. This cycle continues, allowing the PLC to respond in real-time to changes in external signals. A typical scanning cycle ranges from a few milliseconds to several tens of milliseconds.
1.2 Comparison of Mainstream PLC Brands
The main PLC brands in the market include Siemens, Mitsubishi, Allen-Bradley, and Omron. Among them:
- Siemens S7 Series: A comprehensive software programming environment, high global market share, extensive technical support, suitable for automation projects of various scales. The S7-200 is its entry-level PLC, offering high cost-performance, suitable for small to medium control systems.
- Mitsubishi FX Series: Fast instruction execution speed, compact size, particularly suitable for applications requiring high speed.
- AB CompactLogix/ControlLogix: Dominates the North American market, flexible programming, suitable for complex control systems.
1.3 PLC Programming Languages
According to the IEC 61131-3 standard, commonly used PLC programming languages include:
- Ladder Diagram (LAD): The most intuitive, derived from relay control circuits, with a low learning threshold, suitable for beginners.
- Function Block Diagram (FBD): Modularizes control programs, suitable for complex process control.
- Statement List (STL/IL): Similar to assembly language, high execution efficiency but lower readability.
- Structured Text (ST): Similar to high-level languages, suitable for implementing complex algorithms.
- Sequential Function Chart (SFC): Suitable for describing sequential control processes, clearly displaying state transitions.
2. Hardware Composition of S7-200 PLC
The S7-200 is a compact programmable controller launched by Siemens, characterized by its small size, high speed, and powerful functionality, suitable for small to medium automation control systems.
2.1 Main Hardware Components of S7-200
- CPU: The processing unit responsible for program execution and system control, such as CPU 221, CPU 222, CPU 224, etc.
- Input/Output Modules: Including digital I/O and analog I/O, used to connect sensors and actuators.
- Communication Modules: Such as EM 277 for PROFIBUS-DP communication, CP 243-1 for Ethernet communication.
- Special Function Modules: Such as EM 231 thermocouple input module, EM 235 analog I/O module, etc.
2.2 I/O Addressing Method of S7-200
The S7-200 adopts byte addressing:
- Input Points: I0.0 – I15.7 (I byte.bit)
- Output Points: Q0.0 – Q15.7 (Q byte.bit)
- Internal Relays: M0.0 – M31.7 (M byte.bit)
- Special Memory Bits: SM0.0 – SM179.7 (SM byte.bit)
3. Automatic Control Project Example of a Shuttle Car
3.1 Project Requirement Analysis
A control system is needed to enable a shuttle car to automatically travel back and forth between two fixed positions (Point A and Point B). After reaching the endpoint, the car should stay for a preset time before automatically returning to the starting point. The system needs to have manual/automatic mode switching, emergency stop, fault alarm, and other functions.
3.2 Hardware Configuration
- 1 S7-200 CPU 224 PLC (14 inputs/10 outputs)
- 2 limit switches (detecting positions A and B)
- 1 inverter (controlling the shuttle car’s drive motor)
- 2 buttons (start, stop)
- 1 selector switch (manual/automatic mode selection)
- 1 emergency stop button
- Indicator lights (running, fault, position indication)
3.3 I/O Allocation Table
| Address | Symbol | Description |
|---|---|---|
| I0.0 | Start | Start button |
| I0.1 | Stop | Stop button |
| I0.2 | Auto_Manual | Automatic/manual selection switch (1=automatic, 0=manual) |
| I0.3 | Emergency | Emergency stop button |
| I0.4 | Position_A | Position A switch |
| I0.5 | Position_B | Position B switch |
| Q0.0 | Forward | Forward operation (A→B) |
| Q0.1 | Reverse | Reverse operation (B→A) |
| Q0.2 | Run_Light | Running indicator light |
| Q0.3 | Fault_Light | Fault indicator light |
| Q0.4 | Position_A_Light | Position A indicator light |
| Q0.5 | Position_B_Light | Position B indicator light |
3.4 Program Design Ideas
The program is mainly divided into the following functional blocks:
- System initialization and mode selection
- Automatic operation control
- Manual operation control
- Fault detection and handling
- Status indication control
3.5 Ladder Diagram Program Implementation
The following are key program segments implemented using S7-200 Ladder Diagram Language (LAD):
Network 1: System Initialization and Mode Selection
LD I0.0 // Start buttonAN I0.1 // Not stop buttonAN I0.3 // Not emergency stopLD M0.0 // Power on completion flagALD // Logical AND combination= M0.1 // System running flagLD I0.3 // Not emergency stopA SM0.1 // First scan flag= M0.0 // Power on completion flagLD I0.2 // Automatic mode selectionA M0.1 // System running= M1.0 // Automatic running modeLDN I0.2 // Manual mode selectionA M0.1 // System running= M1.1 // Manual running mode
Network 2: Automatic Operation Control
// A→B ControlLD M1.0 // Automatic modeA I0.4 // Position AAN I0.5 // Not position BAN M2.1 // Not B→A runningAN Q0.1 // Not reverse output= M2.0 // A→B running flagLD M2.0 // A→B running= Q0.0 // Forward output
Network 3: Delay Control
// A Point DelayLD I0.4 // Position AAN M1.0 // Automatic modeAN M2.0 // Not A→B runningTON T33, 50 // 5 seconds delay timer (unit: 100ms)LD T33 // Delay completed= M2.0 // Start A→B running// B Point DelayLD I0.5 // Position BAN M1.0 // Automatic modeAN M2.1 // Not B→A runningTON T34, 50 // 5 seconds delay timer (unit: 100ms)LD T34 // Delay completed= M2.1 // Start B→A running
Network 4: Manual Control
LD M1.1 // Manual modeA I0.0 // Start buttonAN I0.5 // Not position B= Q0.0 // Forward outputLD M1.1 // Manual modeA I0.1 // Stop buttonAN I0.4 // Not position A= Q0.1 // Reverse output
Network 5: Fault Detection
// Network 5: Fault DetectionLD Q0.0 // Forward outputTON T35, 600 // 60 seconds timeout detection (unit: 100ms)LD Q0.1 // Reverse outputTON T36, 600 // 60 seconds timeout detection (unit: 100ms)LD T35 // Forward timeoutAN I0.5 // Not position BLD T36 // Reverse timeoutAN I0.4 // Not position AOLD // Logical OR combination= M3.0 // Timeout fault flagLD M3.0 // Timeout fault= Q0.3 // Fault indicator light
Network 6: Status Indication
LD M0.1 // System running= Q0.2 // Running indicator lightLD I0.4 // Position A= Q0.4 // Position A indicator lightLD I0.5 // Position B= Q0.5 // Position B indicator light
3.6 Program Debugging and Troubleshooting
During debugging, the following common issues and solutions may arise:
- Position switch not triggered: Check the switch installation position, wiring connections, and switch sensitivity.
- Delay time set unreasonably: Adjust the delay parameters according to actual needs to avoid excessively long or short stay times.
- Timeout time set unreasonably: Set the timeout time reasonably based on the actual speed of the shuttle car.
- Program logic errors: Use the S7-200 simulator or state monitoring function to debug the program step by step.
Debugging Tips: Use the forcing function to temporarily fix input states, facilitating testing of program execution under different conditions.
4. Integration of S7-200 with Other Devices
In actual industrial applications, PLCs often need to work in conjunction with other devices:
4.1 Connection of S7-200 with Inverter
This can be achieved in the following two ways:
- Digital I/O Connection: Use the PLC’s output points to connect to the control terminals of the inverter, achieving start/stop and forward/reverse control.
- Analog Connection: Connect the PLC’s analog output (e.g., EM 235 module) to the analog input of the inverter for speed control.
4.2 Connection of S7-200 with Touch Screen
This can be achieved in the following ways:
- Serial Communication: Use the PLC’s RS-485 interface to connect to the touch screen, communicating via the PPI protocol.
- Ethernet Communication: Achieve Ethernet connection through the CP 243-1 module (requires a touch screen that supports Ethernet).
5. Trends in PLC Technology Development
PLC technology is developing in the following directions:
- Stronger Network Communication Capabilities: Support for industrial Ethernet protocols such as PROFINET and EtherNet/IP.
- Integration of Safety Functions: Built-in safety functions that comply with functional safety standards such as IEC 61508.
- Integration with Industry 4.0: Support for data exchange protocols such as OPC UA and MQTT, achieving integration of IT and OT.
- Enhanced Edge Computing Capabilities: Implementing data preprocessing and simple analysis functions at the PLC level.
Safety Reminder: With the increase in network connections, the network security risks of PLC systems are also increasing, and measures such as access control and communication encryption should be strengthened.
6. Learning Resources and Advanced Pathways
For engineers who want to delve deeper into PLC technology, it is recommended to:
- Master the programming software and hardware configuration methods of at least one mainstream PLC brand.
- Learn industrial network communication technologies, such as PROFIBUS and PROFINET.
- Understand the control principles of related industrial equipment, such as inverters and servo systems.
- Master HMI programming and design skills.
- Learn relevant industrial standards and specifications, such as IEC 61131-3.
Recommended Books
- “S7-200 PLC Application Technology”
- “Principles and Applications of Programmable Controllers”
- “Siemens PLC Programming and Application Technology Manual”
7. Conclusion
As the core control device of industrial automation, PLCs play an important role in many fields. This article presents a case study of using the S7-200 to achieve automatic control of a shuttle car, demonstrating the basic methods and techniques of PLC applications. It is hoped that this content will be helpful to PLC beginners and technicians, laying a good foundation for further learning and application of PLC technology.
With the development of Industry 4.0, PLCs will deeply integrate with technologies such as artificial intelligence and big data, playing an increasingly important role in intelligent manufacturing. Engineers should continue to learn, grasp technological trends, and continuously improve their professional capabilities.