
MCU stands for Microcontroller Unit, which is commonly known as a microcontroller. It is a chip-level computer that integrates the CPU frequency and specifications appropriately reduced along with memory, counters, USB, A/D converters, UART, PLC, DMA, and even LCD driver circuits onto a single chip. This allows for various combinations of control tailored for different applications, such as mobile phones, PC peripherals, remote controls, automotive electronics, and industrial applications like stepper motors and robotic arms.
A Brief History of Microcontrollers
second part
third part
The history of microcontrollers is relatively short, but its development has been rapid. The emergence and development of microcontrollers have generally synchronized with that of microprocessors (CPUs). Since Intel first launched the 4-bit microprocessor in 1971, its development can be roughly divided into five stages. Below is an introduction based on the development of Intel’s microcontrollers.
1971-1976: The initial stage of microcontroller development. In November 1971, Intel designed the 4-bit microprocessor Intel 4004, which had an integration level of 2000 transistors/chip, along with RAM, ROM, and shift registers, forming the first MCS-4 microprocessor. Subsequently, Intel launched the 8-bit microprocessor Intel 8008, followed by other companies that also introduced 8-bit microprocessors.
1976-1980: The low-performance microcontroller stage. Represented by the MCS-48 series launched by Intel in 1976, this stage integrated an 8-bit CPU, 8-bit parallel I/O interfaces, 8-bit timers/counters, RAM, and ROM onto a single semiconductor chip. Although its addressing range was limited (not exceeding 4 KB), and it lacked serial I/O, the RAM and ROM capacity was small, and the interrupt system was simple, it could meet the needs of general industrial control and intelligent instruments.
1980-1983: The high-performance microcontroller stage. The high-performance 8-bit microcontrollers launched during this period generally featured serial ports, multi-level interrupt handling systems, and multiple 16-bit timers/counters. The internal RAM and ROM capacity increased, and the addressing range could reach 64 KB, with some chips even including A/D conversion interfaces.
1983-late 1980s: The 16-bit microcontroller stage. In 1983, Intel launched the high-performance 16-bit microcontroller MCS-96 series, which achieved a chip integration level of up to 120,000 transistors/chip due to the latest manufacturing processes.
1990s: Microcontrollers developed in all aspects, including integration, functionality, speed, reliability, and application fields.
first part
Classification and Applications of Microcontrollers
third part
MCUs can be classified based on their memory types into two categories: those without internal ROM and those with internal ROM. For chips without internal ROM, external EPROM must be connected for use (typical example: 8031); chips with internal ROM can be further divided into internal EPROM type (typical chip: 87C51), MASK internal mask ROM type (typical chip: 8051), and internal Flash type (typical chip: 89C51).
By purpose, they can be divided into general-purpose and dedicated types; based on the width of the data bus and the length of data bytes processed at one time, they can be classified as 8, 16, and 32-bit MCUs.
Currently, the most widely used MCU application market in China is consumer electronics, followed by industrial fields and automotive electronics markets. Consumer electronics include household appliances, televisions, gaming consoles, and audio/video systems. Industrial fields include smart homes, automation, medical applications, and renewable energy generation and distribution. The automotive field includes automotive powertrains and safety control systems.
first part
second part
Basic Functions of Microcontrollers
For the vast majority of MCUs, the following functions are the most common and fundamental. The description may vary for different MCUs, but essentially they are fundamentally the same:
1. Timer: Although there are many types of timers, they can be summarized into two main categories: one type is fixed-interval timers, where the timing is set by the system and cannot be controlled by the user program. The system only provides several fixed time intervals for user selection, such as 32Hz, 16Hz, 8Hz, etc. This type of timer is common in 4-bit MCUs and can be used for clocking, timing, and related functions.
The other type is Programmable Timer, which, as the name implies, allows the user program to control the timing. Control methods include selecting the clock source, prescale selection, and setting the preload value. Some MCUs may have all three capabilities, while others may only have one or two. This type of timer is very flexible in application, with various practical uses, the most common being PWM output.
Since the clock source can be freely selected, this type of timer is generally combined with Event Counters.
2. I/O Ports: Every MCU has a certain number of I/O ports. Without I/O ports, an MCU loses its channel for external communication. Depending on the configurability of the I/O ports, they can be divided into several types:
Pure input or pure output ports: These I/O ports are determined by the MCU hardware design and can only be input or output, and cannot be set in real-time by software.
Direct read/write I/O ports: For example, the I/O ports of MCS-51 belong to this category. When executing the read I/O port instruction, it acts as an input port; when executing the write I/O port instruction, it automatically becomes an output port.
Programmatically set input/output direction: The input or output of this type of I/O port is set by the program according to actual needs, allowing for flexible applications and enabling bus-level applications, such as I2C buses and control buses for various LCDs and LED drivers.
When using I/O ports, it is crucial to remember that for input ports, there must be a clear level signal to ensure it is not floating (this can be achieved by adding pull-up or pull-down resistors); for output ports, the output state level must consider external connection conditions to ensure there is no pull current or sink current under standby or static conditions.
3. External Interrupts: External interrupts are also a fundamental function of most MCUs, generally used for real-time signal triggering, data sampling, and status detection. Interrupt methods include rising edge, falling edge, and level triggering. External interrupts are generally implemented through input ports, and if it is an I/O port, the interrupt function will only be enabled when set as input; if it is an output port, the external interrupt function will be automatically disabled (there are some exceptions in ATMEL’s ATiny series, where output ports can also trigger interrupt functions). Applications of external interrupts include:
Detection of externally triggered signals: One is based on real-time requirements, such as controlling thyristors or detecting burst signals, while another situation is for power-saving needs.
Signal frequency measurement: To ensure signals are not missed, external interrupts are the ideal choice.
Data decoding: In remote control applications, to reduce design costs, software methods are often used to decode various encoded data, such as Manchester and PWM encoding.
Button detection and system wake-up: For MCUs that enter sleep mode, external interrupts are generally needed to wake them up, with the most basic form being a button that generates a level change through button actions.
4. Communication Interfaces: The communication interfaces provided by MCUs generally include SPI interfaces, UART, I2C interfaces, etc., which are described as follows:
SPI Interface: This interface is a basic communication method provided by most MCUs, where data transmission is controlled by a synchronous clock. Signals include: SDI (serial data input), SDO (serial data output), SCLK (serial clock), and a Ready signal; in some cases, there may be no Ready signal. This interface can operate in Master or Slave mode, simply put, it depends on who provides the clock signal; the one providing the clock is the Master, and the other is the Slave.
UART (Universal Asynchronous Receive Transmit): This is the most basic type of asynchronous transmission interface, with only two signal lines, Rx and Tx. The basic data format is: Start Bit + Data Bit (7-bits/8-bits) + Parity Bit (Even, Odd, or None) + Stop Bit (1~2 Bits). The time taken for one piece of data is called Baud Rate.
For most MCUs, the length of data bits, data parity methods (odd parity, even parity, or no parity), the length of stop bits, and Baud Rate can be flexibly set through programming. This interface is most commonly used for data communication with the serial port of a PC.
I2C Interface: I2C is a data transmission protocol developed by Philips, also using two signals: SDAT (serial data input/output) and SCLK (serial clock). Its biggest advantage is that multiple devices can be connected to this bus, identified and accessed by their addresses; one of the biggest benefits of the I2C bus is that it is very convenient to implement through software using I/O ports, and the data transmission rate is entirely controlled by SCLK, which can be fast or slow, unlike UART interfaces that have strict rate requirements.
5. Watchdog Timer: The watchdog is also a basic configuration of most MCUs (some 4-bit MCUs may not have this function). For most MCUs, the watchdog can only be reset by the program and cannot be turned off (some are set during program burning, such as Microchip PIC series MCUs), while others may determine whether it is enabled in a specific way, such as Samsung’s KS57 series, where accessing the watchdog register automatically enables it and cannot be turned off. Generally, the reset time of the watchdog can be programmed. The most basic application of the watchdog is to provide a self-recovery capability for the MCU in case of unexpected failures leading to a crash.
/END/
This article is an original piece by CSDN blogger “SunMicro nie”.