What is single chip microcomputer? What is the internal architecture of single chip microcomputer?
Most electronic products use single chip microcomputer (MCU) to perform computing operations and Boolean functions. In this paper, the single chip microcomputer scheme network mainly introduces the basic knowledge of single chip microcomputer and its work, application, advantages and disadvantages.
1、 What is single chip microcomputer?
As the name suggests, single chip microcomputer (MCU) is a micro device that can perform special tasks assigned by users. Tasks may be related to general calculations, such as addition, subtraction, division, and floating point mathematics.
In addition, MCU can also control, process and store information in memory. The memory size varies with different MCU series. In some cases, they are often referred to as "microcomputers on chip". The building blocks of single chip microcomputer are processor, memory and peripheral equipment. Let's discuss it in detail.
2、 Architecture of single chip microcomputer
The following figure is the internal view of MCU architecture.
It consists of supporting hardware, such as internally connected CPU (central processing unit), clock, crystal oscillator, memory and hardware peripherals.
1. Central processing unit
Basically, CPU is the core of MCU. It is the brain that follows the actions given by the user. The CPU obtains instructions from memory (ROM), decodes them and executes them. This technology is called pipelining. Pipeline operation is completed with the help of data bus and address bus. The CPU runs instructions at megahertz (MHz) or gigahertz (GHz).
MCU needs a clock to perform any task. In order to provide the clock to the MCU, the crystal oscillator is driven to the CPU. The choice of crystal oscillator determines the speed of single chip microcomputer. The frequency range of crystal oscillator is usually in the range of MHz.
Registers are data that stores elements. It stores an 8-bit binary word. MCU is equipped with various general and peripheral registers. General purpose registers include program counters (PCS) and stack pointers for storing data and instructions. Peripheral registers are very useful for configuring hardware in MCU.
4. Input / output port
Input / output ports are commonly referred to as GPIO (general purpose input / output) ports. This means that these ports can be used as inputs or outputs. Some micro MCU support standby GPIO. They can be used for a variety of functions. They are required when connecting display devices (LED, LCD and touch screen), motors and other external devices. I / O ports are also used for input sensing and switching purposes.
As you know, there are two types of memory (RAM and ROM). RAM (random access memory) is used for temporary storage of data, and ROM (read only memory) is used for permanent storage.
In order to store data in MCU, the processor architecture is divided into Harvard architecture and von Neumann architecture. Harvard University has a separate memory bus (address bus and data bus) to store instructions and data, while von Neumann has a common memory to store instructions and data.
Timer is the most innovative peripheral, which can produce accurate time delay. It can repeat predefined tasks over a known period of time. Some applications of timer include motor control, on / off relay circuit, GPS (Global Positioning System), home appliance control, etc.
Counter is a kind of peripheral device, which is used to count events that occur outside MCU. The application of counter includes pulse measurement, object detection and so on. They are used for frequency measurement, calculating the temperature rise or fall in the microwave oven, and measuring the set time in the washing machine and electric heater.
8. Serial interface
In electronic products, different devices communicate with each other using serial communication. In order to realize serial communication, UART (universal asynchronous transceiver), I2C and SPI are used. Moreover, advanced protocols such as Ethernet and USB have also appeared in the latest single chip microcomputer.
9. Analog to digital converter (ADC)
The sensor converts physical parameters such as temperature, humidity and pressure into analog signals. The ADC converts the analog signal into digital bytes. The analog signal can be in the form of voltage, current or resistance.
It has an internal clock, which can measure the clock cycle fed by MCU and use its own clock for sampling. The number of clock cycles represents a digital representation of the analog voltage.
10. Digital to analog converter (DAC)
DAC (digital to analog conversion) is opposite to ADC. DAC converts digital data into analog voltage form. Some applications of DAC include digital signal processing, motor control, music player, digital potentiometer and so on.
An interrupt is an event that can complete multiple tasks. When the call is interrupted, the MCU stops the current execution (the first task) and executes other tasks (the second task). After completing the second task, it returns to the first task and performs normal operations.