Since the introduction of PLCs in the United States in the 1960s to replace traditional relay control devices, PLCs have experienced rapid development and have been widely used around the world. Simultaneously, the functions of PLCs have been continuously improved. With the continuous development of computer technology, signal processing technology, control technology, and network technology, and the increasing demands of users, PLCs have added analog signal processing and motion control functions to their existing switch signal processing capabilities. Today, PLCs are no longer limited to logic control; they also play a vital role in motion control, process control, and other fields.
PLC
A PLC (Programmable Logic Controller) is a digital electronic device designed for industrial production. It uses a programmable memory to store programs, execute logic operations, perform sequential control, timing, counting, and arithmetic operations—all user-oriented instructions—and controls various types of machinery or production processes through digital or analog inputs / outputs. It is a core component of industrial control.
microcontroller
A microcontroller is an integrated circuit chip that uses very large-scale integrated circuit technology to integrate a central processing unit (CPU) with data processing capabilities , random access memory (RAM) , read-only memory (ROM) , various I/O ports and interrupt systems, timers / counters, and other functions (and may also include display driver circuits, pulse width modulation circuits, analog multiplexers, A/D converters, etc.) onto a single silicon chip to form a small but complete microcomputer system, which is widely used in various fields.
Microcontrollers are found in various applications, including mobile phones, automotive electronics, stepper motors in industry, and the control of robotic arms. Microcontrollers are characterized by relatively complex programming and maintenance, commonly using C or assembly language for programming, relatively low cost, and relatively limited I/O interfaces.
The difference between PLC and microcontroller
PLC is a relatively mature control system based on a single-chip microcomputer. It is a product of a single-chip microcomputer application system that has been debugged and stabilized, and has strong versatility.
Microcontrollers can be used to build a wide variety of application systems, but in terms of "microcontroller" alone , it is just an integrated circuit. It must be combined with other components and software to form a system in order to be used.
From an engineering perspective, for single projects or projects with very few repetitions, PLCs are quick, convenient, have a high success rate, and good reliability, but they are also more expensive.
For large-scale supporting projects, using a microcontroller system has the advantages of low cost and high efficiency, but it requires considerable R&D strength and industry experience to ensure system stability.
In essence, a PLC is a pre-built microcontroller system (microcontrollers cover a wide range of applications).
Features of PLC
PLCs widely use ladder diagrams instead of traditional computer languages, offering certain advantages for programming. You can think of ladder diagrams as a programming language, similar to assembly language or other computer languages, just with a different scope of application. The typical practice is for the PLC software to convert your ladder diagram into C or assembly language ( depending on the CPU used by the PLC ), and then compile it into machine code using an assembler or C compiler. The PLC simply runs the machine code; the ladder diagram merely makes it easier for the user to operate.
As mentioned, the MCS-51 microcontroller can also be used to build a PLC . However, the 8 -bit CPU is somewhat inadequate for some advanced applications, such as large-scale calculations (including floating-point operations) and embedded systems ( UCOS can now be ported to MCS-51 ). But adding a DSP is sufficient for most requirements. Furthermore, since ladder logic programming is still used, we can convert the ladder logic to C51 and then compile it using KEIL 's C51 compiler. It's not hard to see that different PLC models use different CPUs , which illustrates that a PLC is essentially a pre-built microcontroller system.
From this perspective , PLCs aren't actually that mysterious. Many PLCs are quite simple; their internal CPUs , aside from being faster, are less functional than ordinary microcontrollers. Typically, PLCs use a 16 -bit or 32- bit CPU with one or two serial channels for external communication. An internal timer is usually sufficient; adding a watchdog timer to improve reliability solves the problem.
Furthermore, the key technology of a PLC lies in its internally embedded program that can interpret ladder logic and its auxiliary communication program. The efficiency of the ladder logic interpreter determines the performance of the PLC , while the communication program determines how easily the PLC can exchange information with the outside world. For simple applications, it usually operates as an independent controller, which does not need to exchange information with the outside world; it only needs to have an internally embedded program that can interpret ladder logic.
In fact, the main task in designing a PLC is to develop programs that interpret ladder logic. Modern microcontrollers can completely replace PLCs . While older microcontrollers were inferior to PLCs in terms of stability and electromagnetic interference resistance , modern microcontrollers have achieved high stability and strong anti-interference capabilities, and have already replaced PLCs in some fields.
Can a microcontroller replace a PLC ?
Some argue this is a false question, pointing out that microcontrollers are components, while PLCs are systems comprised of components and extensive software, making them incomparable in this respect—most PLC control chips are actually microcontrollers, meaning a PLC can be considered a secondary development of a microcontroller. In terms of industrial protection ratings alone, the stability and reliability of microcontrollers simply cannot compare to IP67 - rated PLCs ( IP is a letter designation; the first digit indicates contact and foreign object protection, the second indicates waterproofing). Furthermore, PLCs , designed to withstand harsh industrial environments, have even developed a redundant system.
I/O function
Microcontrollers have a very limited number of I/O points, while PLCs , on the other hand, have corresponding I/O points for different field signals that can be directly connected to industrial field devices ( such as buttons, switches, current transmitters, motor starters, or control valves ) , and connected to the CPU motherboard via a bus. Almost any production line in industry has hundreds or even thousands of I/O points, a feat that microcontrollers simply cannot match.
Development cycle
There are over 200 brands of PLCs , and almost every brand has different programming software. They are constantly improving their programming software to make it easier for electrical engineers to use. Various program blocks are also becoming more and more convenient and user-friendly to call, such as PID modules and motion control modules, which greatly reduces the development pressure on engineers and shortens the development cycle.
So how can a microcontroller be implemented? Since there are no readily available modules, development is the only option. Engineers who have worked on non-standard automated equipment often encounter time constraints. Even highly integrated and modular products like PLCs struggle to meet the development cycle required for equipment, let alone a microcontroller that's essentially a blank slate.
Communication distance
Most production lines nowadays require cross-regional integration and monitoring, and the communication methods used are mostly Ethernet with repeaters, or directly using civilian broadband fiber optics. The final product used may very well be Microsoft's Internet Explorer browser. Obviously, PLCs have RJ-45 interfaces, and even if the PLC itself does not have an RJ-45 interface, it can be equipped with an Ethernet module. But can this interface be added to the PCB board of the microcontroller and Ethernet communication be developed? How long would the development take?
programming language
This is both an advantage and a disadvantage for microcontrollers. As mentioned above, there are over two hundred brands of PLCs, and even more programming software. Although the programming languages for most PLCs are similar, electrical engineers need to learn everything from the hardware parameters, software components, and programming software of each different brand of PLC before they can use it proficiently. Microcontrollers, on the other hand, use C or assembly language, which is universal for any microcontroller. In other words, learning C or assembly language allows you to develop desired functions using any microcontroller (provided you have a basic understanding of electrical and electronic engineering).
However, electrical engineers are not electronics engineers. Their work involves more than just considering how a microcontroller drives relays to control machine tools. Some electrical engineers don't even know MCU development languages like C or assembly . In recent years, with the promotion of the IEC-61131-3 standard, more and more PLCs support multiple programming languages, such as ST (similar to C ) and CFC ( similar to circuit diagrams ). This convenient functionality is something that traditional microcontroller development environments simply cannot achieve.
In the field of industrial control, PLCs hold an absolute advantage. Given the current situation (the functionality, stability, ease of use, programming, and maintenance of microcontrollers, etc.), it would be an impossible task, or rather, an arduous task with an indefinite timeframe, for microcontrollers to replace PLCs .