1. What is a Microcontroller?
A microcontroller is an integrated circuit chip that incorporates a Central Processing Unit (CPU) with data processing capabilities, Random Access Memory (RAM), Read-Only Memory (ROM), various I/O ports, an interrupt system, timers/counters, and other functions (which may also include display driver circuits, pulse width modulation circuits, analog multiplexers, A/D converters, etc.) into a single silicon chip, forming a small yet complete computer system.
A functioning computer consists of several components: CPU (for computation and control), RAM (for data storage), ROM (for program storage), and input/output devices (e.g., serial ports, parallel output ports, etc.). In personal computers, these components are divided into several chips installed on a printed circuit board known as the motherboard. In a microcontroller, all these components are integrated into a single integrated circuit chip, hence the name microcontroller (single-chip microcontroller). Additionally, some microcontrollers integrate other components like A/D and D/A converters.
Microcontrollers are control chips, miniature computers, and when combined with a crystal oscillator, memory, address latches, logic gates, seven-segment decoders (displays), buttons (similar to keyboards), expansion chips, interfaces, etc., they form a microcontroller system.
Wow! A CPU in a PC can cost thousands of dollars, and with so many components integrated together, it must be extremely expensive! Moreover, this chip must be quite large.
No, the price is not high, ranging from a few yuan to several dozen yuan, and the size is not large, typically packaged in a 40-pin configuration. Of course, some microcontrollers with more functions have more pins, such as 68 pins, while others may have only over 10 or 20 pins, and some even have just 8 pins.
Why is that?
Functionality varies; for example, some combination audio systems sell for just a few hundred yuan, while a single amplifier may sell for thousands. Additionally, the production volume of these chips is very high, and the technology is well-established. The 51 series microcontrollers have been in production for over a decade, which contributes to the lower price.
Given this, the functionality of microcontrollers must not be strong; why learn about them?
That’s not the case. In practical applications, not every situation that requires a computer necessitates high performance. Does a computer controlling the temperature of a refrigerator need to be a PIII? The key to application is whether it suffices and offers a good performance-to-price ratio. Therefore, even after more than a decade, the 8051 has not been eliminated and continues to develop.
2. The Relationship Between MCS51 Microcontroller and 8051, 8031, 89C51, etc.
We often mention the 8051, but what about the 8031? What is the relationship between the 89C51 and the 89S51?
MCS51 refers to a series of microcontrollers produced by Intel Corporation (yes, the famous Intel), which includes several models like 8031, 8051, 8751, 8032, 8052, and 8752. Among these, the 8051 is the earliest and most typical product. Other microcontrollers in this series are derived from the 8051 with various functional additions, reductions, or modifications. Therefore, people commonly refer to the MCS51 series microcontrollers as 8051. The 8031 was the most popular microcontroller in China a few years ago, which is why you often see its name. Intel has authorized the core technology of MCS51 to many other companies, leading to various companies producing microcontrollers based on the 8051 core, albeit with some functional variations to meet different needs. The 89C51, for instance, has become very popular in China in recent years and is developed by Atmel Corporation in the USA. In the future, we will use the 89C51 microcontroller to conduct a series of experiments.
Microcontrollers are also known as microcontrollers because they were first used in industrial control. Microcontrollers evolved from dedicated processors that only had a CPU on the chip. The original design concept was to integrate a large number of peripheral devices and the CPU into one chip, making computer systems smaller and easier to integrate into complex control devices with strict size requirements. Intel’s Z80 was the first processor designed with this idea, leading to a divergence in the development of microcontrollers and dedicated processors. Early microcontrollers were primarily 8-bit or 4-bit. The most successful was Intel’s 8031, which gained significant praise for its simplicity, reliability, and decent performance. Subsequently, the MCS51 series microcontroller system was developed from the 8031. This microcontroller system is still widely used today. With the increasing demands in the industrial control sector, 16-bit microcontrollers began to appear, but they did not gain widespread application due to their poor cost-performance ratio. After the 1990s, with the rapid development of consumer electronics, microcontroller technology improved significantly. With the widespread application of Intel’s i960 series and later ARM series, 32-bit microcontrollers rapidly replaced 16-bit microcontrollers in high-end markets and entered the mainstream. Meanwhile, the performance of traditional 8-bit microcontrollers has also improved dramatically, with processing capabilities increasing hundreds of times compared to the 1980s. Currently, high-end 32-bit microcontrollers operate at frequencies exceeding 300MHz, competing with dedicated processors from the mid-1990s, while the prices of standard models have dropped to around $1, with the highest-end models costing only $10. Modern microcontroller systems are no longer developed and used solely in bare-metal environments; a large number of dedicated embedded operating systems are widely used across all series of microcontrollers. In high-end microcontrollers, which serve as the core processors for handheld computers and mobile phones, specialized versions of Windows and Linux operating systems can even be directly used.
Microcontrollers are more suitable for embedded systems than dedicated processors, which is why they are widely applied. In fact, microcontrollers are the most numerous type of computer in the world. Almost every electronic and mechanical product used in modern human life integrates microcontrollers. Mobile phones, telephones, calculators, household appliances, electronic toys, handheld computers, and even computer peripherals like mice all contain 1-2 microcontrollers. Personal computers also utilize a significant number of microcontrollers. Cars typically have over 40 microcontrollers, and complex industrial control systems may have hundreds of microcontrollers operating simultaneously! The number of microcontrollers far exceeds that of PCs and other computing devices, even surpassing the human population.
Microcontroller Introduction
A microcontroller, also known as a single-chip microcontroller, is not a chip that performs a single logical function but integrates an entire computer system onto one chip. It is equivalent to a miniature computer, lacking only I/O devices compared to a full-fledged computer. In summary, one chip constitutes a computer. Its small size, light weight, low cost, and convenience for learning, application, and development make it an excellent choice for understanding computer principles and structures.
Microcontrollers also use modules similar to those in computers, such as CPUs, memory, parallel buses, and storage devices that function like hard drives. The difference is that these components are generally much weaker in performance than those in our home computers, but they are also low-cost, typically not exceeding 10 yuan. They are sufficient for performing relatively uncomplicated tasks like controlling electrical appliances. You can see their presence in fully automatic washing machines, range hoods, VCD players, and other household appliances! They primarily serve as the core components for control.
They are real-time online control computers, meaning they perform field control and require strong anti-interference capabilities at low costs, which is a major difference from offline computers (like home PCs).
Microcontrollers operate based on programs, which can be modified. Different programs can achieve different functionalities, especially unique functions that would be difficult or cumbersome for other devices to accomplish. A moderately complex function, if implemented using the 74 series developed in the 1950s or the CD4000 series from the 1960s, would result in a large PCB board! However, if the same function is implemented using the microcontrollers successfully launched in the 1970s, the outcome would be drastically different! This is because microcontrollers can achieve high intelligence, efficiency, and reliability through your written programs!
Since microcontrollers are sensitive to costs, the dominant software remains low-level assembly language, which is the lowest-level language besides binary machine code. Why use such a low-level language when many high-level languages have reached visual programming levels? The reason is simple: microcontrollers do not have CPUs like home computers nor massive storage devices like hard drives. Even a small program written in a visual high-level language, containing just one button, can reach dozens of kilobytes in size! While this is manageable for home PC hard drives, it is unacceptable for microcontrollers. The utilization of hardware resources in microcontrollers must be very high, which is why assembly language, though primitive, is still widely used. Similarly, if we were to run the operating systems and applications of giant computers on home PCs, the home PCs would also struggle to handle them.
It can be said that the 20th century has traversed three eras of “electricity”: the electrical era, the electronic era, and the current computer era. However, this computer usually refers to personal computers, abbreviated as PCs. They consist of the main unit, keyboard, monitor, and other components. There is another type of computer that most people are not familiar with: the microcontroller (also known as a microcontroller), which imparts intelligence to various machines. As the name suggests, the smallest system of this computer uses only one integrated circuit to perform simple calculations and controls. Because of its small size, it is usually hidden inside the “belly” of the controlled machinery. In the entire system, it acts like the human brain; if it malfunctions, the entire system fails. Nowadays, the application fields of these microcontrollers are very broad, including intelligent instruments, real-time industrial control, communication devices, navigation systems, household appliances, etc. Once a product uses a microcontroller, it can achieve an upgrade effect, often prefixed with the adjective “smart,” such as smart washing machines.
Some products developed by technical personnel in factories or other amateur electronic developers are either too complex in circuitry or too simple in function and easily replicated. The reason may lie in the product not utilizing microcontrollers or other programmable logic devices.
Microcontroller History
Microcontrollers emerged in the late 1970s, experiencing three major stages: SCM, MCU, and SoC.
1. SCM refers to the Single Chip Microcomputer stage, which primarily seeks the optimal embedded system architecture for the best single-chip form. The “innovative model” achieved success and established a development path completely different from general-purpose computers. Intel played a significant role in pioneering the independent development path of embedded systems.
2. MCU refers to the Microcontroller Unit stage, where the main technical development direction is to continuously expand various peripheral circuits and interface circuits to meet the requirements of embedded applications, highlighting the intelligent control capabilities of the objects. The responsibility for developing MCUs inevitably falls on electrical and electronic technology manufacturers, as it relates to the object system. From this perspective, Intel’s gradual withdrawal from MCU development has its objective factors. The most notable manufacturer in MCU development is Philips. Philips has rapidly developed the MCS-51 from a single-chip microcomputer to a microcontroller, thanks to its enormous advantages in embedded applications. Therefore, when we review the development path of embedded systems, we must not forget the historical contributions of Intel and Philips.
3. The microcontroller represents the independent development path of embedded systems, and an important factor in its transition to the MCU stage is seeking maximum solutions for application systems on chips; thus, the development of dedicated microcontrollers naturally forms a trend toward SoC. With the advancement of microelectronics technology, IC design, and EDA tools, the design of SoC-based microcontroller application systems will see significant development. Therefore, the understanding of microcontrollers can extend from single-chip microcomputers and single-chip microcontrollers to single-chip application systems.
Microcontroller Application Areas
Currently, microcontrollers have penetrated various fields of our lives, making it difficult to find any area without traces of microcontrollers. Navigation devices for missiles, control of various instruments on airplanes, network communication and data transmission in computers, real-time control and data processing in industrial automation processes, widely used intelligent IC cards, safety assurance systems in luxury civilian cars, control of video recorders, cameras, fully automatic washing machines, as well as programmable toys, electronic pets, etc., all rely on microcontrollers. Not to mention robots, intelligent instruments, and medical devices in the field of automatic control. Therefore, learning, developing, and applying microcontrollers will cultivate a group of scientists and engineers in computer applications and intelligent control.
Microcontrollers are widely used in instruments and meters, household appliances, medical devices, aerospace, and intelligent management and process control of specialized equipment, generally categorized as follows:
1. Application in Intelligent Instruments and Meters
Microcontrollers have the advantages of small size, low power consumption, strong control functions, flexible expansion, miniaturization, and ease of use, making them widely used in instruments and meters. By combining with different types of sensors, they can measure various physical quantities such as voltage, power, frequency, humidity, temperature, flow, speed, thickness, angle, length, hardness, elements, pressure, etc. Using microcontrollers for control enables instruments and meters to become digital, intelligent, and miniaturized, with functions far superior to those using electronic or digital circuits, such as precision measuring equipment (power meters, oscilloscopes, various analyzers).
2. Application in Industrial Control
Microcontrollers can form various control systems and data acquisition systems. For example, intelligent management of factory assembly lines, intelligent control of elevators, various alarm systems, and secondary control systems connected to computers, etc.
3. Application in Household Appliances
It can be said that modern household appliances basically use microcontroller control, from rice cookers, washing machines, refrigerators, air conditioners, color televisions, and other audio-visual equipment to electronic weighing devices, they are everywhere.
4. Application in Computer Networks and Communication Fields
Modern microcontrollers generally have communication interfaces, making it easy to communicate data with computers, providing excellent material conditions for applications between computer networks and communication devices. Nowadays, communication devices basically implement intelligent control using microcontrollers, from mobile phones, telephones, small programmable switching devices, building automatic communication calling systems, to everyday items like mobile phones, cluster mobile communication, and walkie-talkies.
5. Application in Medical Devices
Microcontrollers are also widely used in medical devices, such as medical ventilators, various analyzers, monitors, ultrasound diagnostic equipment, and patient call systems, etc.
6. Modular Applications in Various Large Appliances
Some dedicated microcontrollers are designed to implement specific functions, allowing for modular applications in various circuits without requiring users to understand their internal structure. For example, music integrated microcontrollers, which seem to have simple functions, are actually complex and similar to computer principles. For instance, music signals are stored in digital form in memory (similar to ROM), read out by microcontrollers, and converted into analog music electrical signals (similar to sound cards).
In large circuits, this modular application greatly reduces size, simplifies circuits, lowers damage and error rates, and facilitates replacement.
7. Application in Automotive Equipment
Microcontrollers are widely used in automotive electronics, such as engine controllers in cars, intelligent electronic controllers for automotive engines based on CAN bus, GPS navigation systems, ABS anti-lock braking systems, braking systems, etc. Additionally, microcontrollers have extensive applications in commerce, finance, scientific research, education, national defense, and aerospace.