1. What is a single chip microcomputer?
A single-chip microcomputer 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, multiple I/O ports and interrupt systems, timers/counters and other functions (may also include display driver circuits, pulse width modulation circuits, analog multiplexers, A/D converters and other circuits) onto a small and complete computer system.
A working computer must consist of several parts: CPU (for calculation and control), RAM (data storage), ROM (program storage), and input/output devices (for example, serial port, parallel output port, etc.). On a personal computer, these parts are divided into several chips and installed on a printed circuit board called a motherboard. In a single-chip microcomputer, all these parts are made into an integrated circuit chip, so it is called a single-chip (single-chip) machine. In addition to the above parts, some single-chip microcomputers also integrate other parts such as A/D, D/A, etc.
A single-chip microcomputer is a control chip, a miniature computer, and with the addition of a crystal oscillator, memory, address latch, logic gates, seven-segment decoder (display), buttons (similar to a keyboard), expansion chips, interfaces, etc., it is a single-chip microcomputer system.
Oh my god! The CPU in a PC costs thousands of dollars each. With so many things put together, the price must be sky-high! Besides, this chip must be very large.
No, the price is not high, ranging from a few yuan to dozens of yuan, and the size is not large. It is generally packaged in 40 pins. Of course, microcontrollers with more functions also have more pins, such as 68 pins, while those with fewer functions have only more than 10 or 20 pins, and some even have only 8 pins.
Why is this happening?
Functions vary. For example, some stereo systems on the market only cost a few hundred yuan, but some amplifiers cost thousands. In addition, the production volume of this type of chip is large, and the technology is mature. The 51 series of single-chip microcomputers have been produced for more than ten years, so the price is low.
In this case, the functions of the microcontroller must not be strong, so why should we learn it?
That's not true. In actual work, not every occasion that requires a computer requires a high performance. Does a computer that controls the temperature of a refrigerator need to use PIII? The key to application is whether it is sufficient and whether it has a good performance-price ratio. Therefore, 8051 has not been eliminated for more than ten years and is still developing.
2. The relationship between MCS51 microcontroller and 8051, 8031, 89C51, etc.
We usually talk about 8051, 8031, and now there is 89C51 and 89s51. What is the relationship between them?
MCS51 refers to the general name of a series of single-chip microcomputers produced by the American INTEL company (yes, the famous INTEL). This series of single-chip microcomputers includes many varieties, such as 8031, 8051, 8751, 8032, 8052, 8752, etc. Among them, 8051 is the earliest and most typical product. The other single-chip microcomputers in this series are based on 8051. The functions are added, reduced, and changed. Therefore, people are accustomed to using 8051 to call the MCS51 series of single-chip microcomputers. 8031 was the most popular single-chip microcomputer in my country in the past few years, so the name of 8031 can be seen in many occasions. INTEL has authorized the core technology of MCS51 to many other companies, so many companies are making single-chip microcomputers with 8051 as the core. Of course, the functions have changed more or less to meet different needs. Among them, 89C51 is a very popular single-chip microcomputer in my country in recent years. It is developed and produced by the American ATMEL company. In the future we will use the 89C51 microcontroller to complete a series of experiments.
Single-chip microcomputers are also called microcontrollers because they were first used in the field of industrial control. Single-chip microcomputers evolved from dedicated processors with only a CPU in the chip. The earliest design concept was to integrate a large number of peripherals and the CPU into one chip to make the computer system smaller and easier to integrate into complex control devices with strict volume requirements. INTEL's Z80 was the first processor designed according to this idea. Since then, the development of single-chip microcomputers and dedicated processors has gone their separate ways.
Early single-chip microcomputers were all 8-bit or 4-bit. The most successful one was INTEL's 8031, which was highly praised for its simplicity, reliability and good performance. After that, the MCS51 series of single-chip microcomputer systems were developed based on the 8031. Single-chip microcomputer systems based on this system are still widely used today. With the increasing requirements in the field of industrial control, 16-bit single-chip microcomputers began to appear, but they were not widely used because of their poor cost performance. After the 1990s, with the rapid development of consumer electronic products, single-chip microcomputer technology has been greatly improved. With the widespread application of the INTEL i960 series, especially the later ARM series, 32-bit single-chip microcomputers quickly replaced the high-end status of 16-bit single-chip microcomputers and entered the mainstream market. The performance of traditional 8-bit single-chip microcomputers has also been rapidly improved, and the processing power has increased hundreds of times compared with the 1980s. At present, the main frequency of high-end 32-bit single-chip microcomputers has exceeded 300MHz, and the performance is catching up with the dedicated processors in the mid-1990s. The factory price of ordinary models has fallen to US$1, and the highest-end models are only US$10. Contemporary single-chip microcomputer systems are no longer developed and used only in bare metal environments. A large number of dedicated embedded operating systems are widely used on a full range of single-chip microcomputers. High-end single-chip microcomputers that serve as core processors for handheld computers and mobile phones can even directly use dedicated Windows and Linux operating systems.
单片机比专用处理器更适合应用于嵌入式系统,因此它得到了最多的应用。事实上单片机是世界上数量最多的计算机。现代人类生活中所用的几乎每件电子和机械产品中都会集成有单片机。手机、电话、计算器、家用电器、电子玩具、掌上电脑以及鼠标等电脑配件中都配有1-2部单片机。而个人电脑中也会有为数不少的单片机在工作。汽车上一般配备40多部单片机,复杂的工业控制系统上甚至可能有数百台单片机在同时工作!单片机的数量不仅远超过PC机和其他计算的综合,甚至比人类的数量还要多。
Introduction to MCU
A single-chip microcomputer is also called a single-chip microcontroller. It is not a chip that completes a certain logical function, but a computer system integrated into one chip. It is equivalent to a microcomputer. Compared with a computer, a single-chip microcomputer only lacks I/O devices. In general, a chip becomes a computer. It is small in size, light in weight, and cheap in price, providing convenient conditions for learning, application and development. At the same time, learning to use a single-chip microcomputer is the best choice to understand the principles and structure of computers.
The microcontroller also uses modules similar to those in computers, such as CPU, memory, parallel bus, and storage devices that have the same functions as hard disks. The difference is that the performance of these components is much weaker than that of our home computers, but the price is also low, generally no more than 10 yuan... It is enough to use it to do some not very complicated work such as controlling electrical appliances. We can see it in the fully automatic drum washing machine, exhaust hood, VCD and other home appliances we use now!... It is mainly used as the core component of the control part.
It is an online real-time control computer. Online means on-site control, which requires strong anti-interference ability and low cost. This is also the main difference from offline computers (such as home PCs).
The microcontroller relies on programs and can be modified. Different functions can be realized through different programs, especially some special and unique functions, which other devices need to spend a lot of effort to achieve, and some are difficult to achieve even with great effort. If a not very complicated function is solved by pure hardware such as the 74 series developed in the 1950s in the United States, or the CD4000 series in the 1960s, the circuit must be a large PCB board! But if you use the series of microcontrollers successfully launched in the market in the 1970s in the United States, the results will be very different! Just because the microcontroller can achieve high intelligence, high efficiency, and high reliability through the program you write!
Since MCU is cost-sensitive, the dominant software is still the lowest-level assembly language, which is the lowest-level language besides binary machine code. Why should it be used if it is so low-level? Many high-level languages have reached the level of visual programming, so why not use them? The reason is very simple, that is, MCU does not have a CPU like a home computer, nor does it have a massive storage device like a hard disk. Even if there is only one button in a small program written in a visual high-level language, it will reach a size of tens of K! It is nothing for the hard disk of a home PC, but it is unacceptable for a MCU. The utilization rate of hardware resources of MCU must be very high, so although assembly is primitive, it is still widely used. In the same way, if the operating system and application software on a giant computer are taken to a home PC to run, the home PC will not be able to bear it.
It can be said that the 20th century spanned three "electrical" eras, namely the electrical era, the electronic era, and the computer era that has now arrived. However, this type of computer usually refers to a personal computer, referred to as a PC. It consists of a host, a keyboard, a display, etc. There is another type of computer that most people are not very familiar with. This type of computer is a single-chip microcomputer (also known as a microcontroller) that gives 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 in the "belly" of the controlled machine. It plays a role like a human brain in the entire device. If it goes wrong, the entire device will be paralyzed. Now, this type of single-chip microcomputer has been used in a wide range of fields, such as intelligent instruments, real-time industrial control, communication equipment, navigation systems, household appliances, etc. Once various products use single-chip microcomputers, they can upgrade the products, and the adjective "intelligent" is often prefixed to the product name, such as intelligent washing machines. Some products developed by technicians in some factories or other amateur electronic developers now have either too complex circuits or too simple functions and are easily imitated. The reason may be that the product does not use a single-chip microcomputer or other programmable logic devices.
History of MCU
The single-chip microcomputer was born in the late 1970s and has gone through three major stages: SCM, MCU, and SoC.
1. The SCM (Single Chip Microcomputer) stage mainly seeks the best architecture for the best single-chip embedded system. The success of the "innovation model" has laid a completely different development path for SCM and general-purpose computers. Intel has made an indelible contribution to the independent development of embedded systems.
2. MCU (Micro Controller Unit) stage, the main direction of technology development is: to continuously expand the various peripheral circuits and interface circuits required by the target system when meeting embedded applications, highlighting the intelligent control capabilities of the target. The fields it involves are all related to the target system, so the responsibility of developing MCU inevitably falls on electrical and electronic technology manufacturers. From this perspective, Intel's gradual withdrawal from the development of MCU also has its objective factors. In terms of developing MCU, the most famous manufacturer is Philips.
Philips, with its great advantages in embedded applications, quickly developed MCS-51 from a single-chip microcomputer to a microcontroller. Therefore, when we review the development of embedded systems, we should not forget the historical achievements of Intel and Philips.
3. Single-chip microcomputer is the independent development path of embedded system. The important factor of development to MCU stage is to seek the maximum solution of application system on chip; therefore, the development of special single-chip microcomputer naturally forms the trend of SoC. With the development of microelectronics technology, IC design and EDA tools, the design of single-chip microcomputer application system based on SoC will have great development. Therefore, the understanding of single-chip microcomputer can be extended from single-chip microcomputer and single-chip microcontroller to single-chip application system.
Application fields of single chip microcomputer
At present, single-chip microcomputers have penetrated into every field of our lives. It is almost difficult to find a field without single-chip microcomputers. Missile navigation devices, control of various instruments on aircraft, computer network communication and data transmission, real-time control and data processing of industrial automation processes, widely used smart IC cards, safety systems of civilian luxury cars, control of video recorders, cameras, fully automatic washing machines, as well as program-controlled toys, electronic pets, etc., all of these are inseparable from single-chip microcomputers. Not to mention robots, intelligent instruments, and medical equipment in the field of automatic control. Therefore, the study, development, and application of single-chip microcomputers will create a group of scientists and engineers in computer application and intelligent control.
Single chip microcomputers are widely used in the fields of instrumentation, household appliances, medical equipment, aerospace, intelligent management and process control of special equipment, etc., which can be roughly divided into the following categories:
1. Application in intelligent instruments
Single-chip microcomputers have the advantages of small size, low power consumption, strong control function, flexible expansion, miniaturization and easy use. They are widely used in instruments and meters. Combined with different types of sensors, they can measure physical quantities such as voltage, power, frequency, humidity, temperature, flow, speed, thickness, angle, length, hardness, elements, pressure, etc. The use of single-chip microcomputer control makes instruments and meters digital, intelligent, and miniaturized, and their functions are more powerful than those using electronic or digital circuits. For example, precision measuring equipment (power meters, oscilloscopes, various analyzers). [page]
2. Application in industrial control
Single chip microcomputers can be used to form various control systems and data acquisition systems, such as intelligent management of factory assembly lines, intelligent elevator control, various alarm systems, and networking with computers to form a secondary control system.
3. Application in household appliances
It can be said that most of the current household appliances are controlled by single-chip microcomputers, ranging from rice cookers, washing machines, refrigerators, air conditioners, color TVs, other audio and video equipment, to electronic weighing equipment, which are diverse and ubiquitous.
4. Application in computer network and communication fields
Modern single-chip microcomputers generally have communication interfaces, which can easily communicate data with computers, providing excellent material conditions for their application in computer networks and communication equipment. Currently, most communication equipment has realized single-chip microcomputer intelligent control, from mobile phones, telephones, small programmable switches, building automatic communication call systems, train wireless communications, to mobile phones that can be seen everywhere in daily work, cluster mobile communications, radio walkie-talkies, etc.
5. Application of single chip microcomputer in medical equipment field
Microcontrollers are also widely used in medical equipment, such as medical ventilators, various analyzers, monitors, ultrasonic diagnostic equipment, bed call systems, etc.
6. Modular application in various large electrical appliances
Some dedicated microcontrollers are designed to achieve specific functions, so that they can be used modularly in various circuits without requiring users to understand their internal structure. For example, the music integrated microcontroller, which seems to have simple functions, is miniaturized in a pure electronic chip (different from the principle of a tape recorder), which requires complex computer-like principles. For example: the music signal is stored in a memory in digital form (similar to ROM), read by the microcontroller, and converted into an analog music electrical signal (similar to a sound card).
In large circuits, this modular application greatly reduces the size, simplifies the circuit, reduces damage and error rates, and facilitates replacement.
7. Application of MCU in the field of automotive equipment
Microcontrollers are widely used in automotive electronics, such as engine controllers in cars, intelligent electronic controllers for car engines based on CAN bus, GPS navigation systems, ABS anti-lock braking systems, braking systems, and so on.
In addition, single-chip microcomputers have a wide range of uses in industry and commerce, finance, scientific research, education, national defense, aerospace and other fields.
Learn to apply six important parts
Six important parts of microcontroller learning and application
1. Bus: We know that a circuit is always made up of components connected by wires. In analog circuits, wiring is not a problem because the devices are generally in serial relationship and there are not many wires between the devices. However, computer circuits are different. They are based on microprocessors. All devices must be connected to the microprocessor and the work between the devices must be coordinated with each other, so a lot of wires are needed. If the microprocessor and the device are connected separately as in analog circuits, the number of wires will be amazing. Therefore, the concept of bus is introduced in microprocessors. Each device shares the wires. The 8 data lines of all devices are connected to 8 common lines, which is equivalent to connecting the devices in parallel. However, this is not enough. If two devices send data at the same time, one is 0 and the other is 1, then what will the receiver receive? This situation is not allowed, so it is necessary to control through control lines to make the devices work in time-sharing mode. Only one device can send data at any time (multiple devices can receive data at the same time). The data line of the device is also called the data bus, and all the control lines of the device are called the control bus. There are storage units inside the microcontroller or in external memory and other devices. These storage units must be assigned addresses before they can be used. The assigned addresses are of course given in the form of electrical signals. Since there are many storage units, there are also many lines used for address allocation. These lines are called address buses.
2. Data, address, and instruction: The reason why these three are put together is that the essence of these three is the same - numbers, or a sequence of '0' and '1'. In other words, addresses and instructions are also data. Instruction: A number specified by the designer of the microcontroller chip. It has a strict one-to-one correspondence with the instruction mnemonics we commonly use and cannot be changed by the developer of the microcontroller. Address: It is the basis for finding the internal and external storage units and input and output ports of the microcontroller. The address value of the internal unit has been specified by the chip designer and cannot be changed. The external unit can be determined by the microcontroller developer, but some address units must be there (see the execution process of the program for details). Data: This is the object processed by the microprocessor. It is different in various application circuits. Generally speaking, the data being processed may be in the following situations:
1o address (such as MOV DPTR, 1000H), that is, address 1000H is sent to DPTR.
2o mode word or control word (such as MOV TMOD, #3), 3 is the control word.
3o constant (such as MOV TH0, #10H) 10H is the timing constant.
4o Actual output value (e.g., if you want to connect colored lights to the P1 port, and want all lights to be bright, execute the command: MOV P1, #0FFH, if you want to want all lights to be dark, execute the command: MOV P1, #00H) Here, 0FFH and 00H are both actual output values. Another example is the font code used for LED, which is also the actual output value.
Once you understand the nature of addresses and instructions, it is not difficult to understand why the program may run wild during execution and why data may be executed as instructions.
3. The second function usage of P0, P2 and P3: Beginners are often confused about the second function usage of P0, P2 and P3, thinking that there must be a switching process between the second function and the original function, or an instruction. In fact, the second function of each port is completely automatic and does not require instructions to switch. For example, P3.6 and P3.7 are WR and RD signals respectively. When the microprocessor is connected to an external RAM or has an external I/O port, they are used as the second function and cannot be used as a general I/O port. As long as the microprocessor executes the MOVX instruction, the corresponding signal will be sent from P3.6 or P3.7, and there is no need to use instructions in advance. In fact, "cannot be used as a general I/O port" does not mean "cannot" but (users) "will not" use it as a general I/O port. You can completely arrange a SETB P3.7 instruction in the instruction, and when the microcontroller executes this instruction, P3.7 will also become a high level, but users will not do so because it usually causes the system to crash.
4. Program execution process: After the microcontroller is powered on and reset, the value of the program counter (PC) in 8051 is '0000', so the program always starts executing from the '0000' unit, that is to say: the unit '0000' must exist in the system's ROM, and there must be an instruction stored in the '0000' unit.
5. Stack: The stack is an area used to store data. This area itself has nothing special. It is just a part of the internal RAM. What is special is the way it stores and retrieves data, which is the so-called "first in, last out, last in, first out". The stack has special data transfer instructions, namely "PUSH" and "POP", and there is a special unit dedicated to it, namely the stack pointer SP. Whenever a PUSH instruction is executed, SP automatically increases by 1 (based on the original value), and whenever a POP instruction is executed, SP automatically decreases by 1 (based on the original value). Since the value in SP can be changed by instructions, as long as the value of SP is changed at the beginning of the program, the stack can be set in the specified memory unit. For example, at the beginning of the program, a MOV SP, #5FH instruction is used to set the stack in the unit starting from memory unit 60H. Generally, there is always an instruction to set the stack pointer at the beginning of a program. Because when the computer is turned on, the initial value of SP is 07H, so the stack starts from unit 08H and goes backwards. The area from 08H to 1FH is the second, third, and fourth working register area of 8031, which is often used, which will cause data confusion. When different authors write programs, the initialization instructions for the stack are not exactly the same. This is a matter of habit. When the stack area is set, it does not mean that the area becomes a special memory. It can still be used like a normal memory area, but programmers generally do not use it as normal memory.
6. The development process of the single-chip microcomputer: The development process mentioned here is not the one that starts with task analysis as described in general books. We assume that the hardware has been designed and manufactured, and the next step is to write the software. Before writing the software, we must first determine some constants and addresses. In fact, these constants and addresses have been determined directly or indirectly during the design stage. For example, when the connection of a device is designed, its address is also determined. When the function of the device is determined, its control word is also determined. Then use a text editor (such as EDIT, CCED, etc.) to write the software. After writing, use a compiler to compile the source program file and check for errors until there are no syntax errors. Except for very simple programs, the software is generally debugged using an emulator until the program runs correctly. After running correctly, you can write to the chip (solidify the program in the EPROM). After the source program is compiled, a target file with an extension of HEX is generated. Generally, the programmer can recognize files in this format. As long as this file is loaded, the chip can be written. Here, in order to give everyone an understanding of the whole process, an example is given:
MCU test board ORG 0000H
LJMP START
ORG 040H
START:
MOV SP, #5FH; set stack
LOOP:
NOP
LJMP LOOP ; loop
END ; End
MCU Learning
At present, many people do not approve of assembly language. It can be said that it is very important to master the C language microcontroller programming, which can greatly improve the efficiency of development. However, beginners do not need to understand the assembly language of the microcontroller, but they must understand the specific performance and characteristics of the microcontroller, otherwise it will be fatal in the field of microcontrollers. If you do not consider the hardware resources of the microcontroller and program randomly in C in KEIL, the result can only be that there is a problem that cannot be solved! It can be said with certainty that the best C language microcontroller engineers are programmers who come out of assembly because although the C language of the microcontroller is a high-level language, it is different from VC++ on desktop personal computers. The hardware resources of the microcontroller are not very powerful, and it is different from us using VC, VB and other high-level languages to write programs on desktop PCs. After all, the hardware of desktop computers is very powerful, so we can ignore the problem of hardware resources. In addition, although C language is easy to program and easy for people to read in microcontroller programming, its execution efficiency is 10% to 20% lower than that of assembly language, so what language to use to write a program depends on the specific occasion. In general, microcontroller programming requires the flexible use of assembly language and C language to display the powerful functions of the microcontroller to users with the highest efficiency.
Take 8051 microcontroller as an example to explain the microcontroller's pins and related functions;
《Microcontroller Pin Diagram》
The 40 pins can be roughly divided into four categories according to their functions: power, clock, control and I/O pins.
1. Power supply:
⑴ VCC - chip power supply, connected to +5V;
⑵ VSS - ground terminal;
Note: When testing the MCU pin voltage with a multimeter, it is usually 0v or 5v, which is the standard TTL level. But sometimes when the MCU program is working, the test result is not this value but between 0v-5v. In fact, this is because the multimeter's response speed is not so fast. At a certain moment, the MCU pin voltage remains at 0v or 5v. [page]
⒉ Clock: XTAL1, XTAL2 - inverting input and output of the crystal oscillator circuit.
⒊ Control line: There are 4 control lines in total.
⑴ ALE/PROG: Address latch enable/on-chip EPROM programming pulse
① ALE function: used to latch the lower 8 bits of the address sent from port P0
② PROG function: For chips with built-in EPROM, this pin inputs programming pulses during EPROM programming.
⑵ PSEN: External ROM read select signal.
⑶ RST/VPD: reset/backup power supply.
① RST (Reset) function: reset signal input terminal.
② VPD function: When Vcc loses power, connect to backup power supply.
⑷ EA/Vpp: internal and external ROM selection/on-chip EPROM programming power supply.
① EA function: internal and external ROM selection terminal.
② Vpp function: For chips with EPROM inside, the programming power Vpp is applied during EPROM programming.
4. I/O lines
The 80C51 has four 8-bit parallel I/O ports: P0, P1, P2, and P3, with a total of 32 pins.
The P3 port also has a second function, which is used for special signal input and output and control signals (belongs to the control bus).
5. P3 port second function
P30 RXD Serial input port
P31 TXD serial output port
P32 INT0 External interrupt 0 (low level valid)
P33 INT1 External interrupt 1 (Low level valid)
P34 T0 Timing counter 0
P35 T1 Timing counter 1
P36 WR External data memory write strobe (low level valid)
P37 RD External data memory read strobe (low level valid)
Introduction to Commonly Used MCU Chips
STC MCU
STC's microcontroller is mainly based on the 8051 core. It is a new generation of enhanced microcontroller. The instruction code is fully compatible with the traditional 8051. The speed is 8 to 12 times faster. It has ADC, 4-way PWM, dual serial ports, a globally unique ID number, good encryption, and strong anti-interference.
PIC microcontroller:
It is a product of MICROCHIP. Its outstanding features are small size, low power consumption, streamlined instruction set, good anti-interference, high reliability, strong analog interface, good code confidentiality, and most chips are compatible with FLASH program memory chips.
EMC microcontroller:
It is a product of Taiwan Elan Corporation. A large part of it is compatible with PIC 8-bit microcontrollers. The resources of compatible products are relatively more than PIC, the price is cheap, and there are many series to choose from, but the anti-interference is poor.
ATMEL MCU (51 MCU):
ATME1's 8-bit microcontrollers include AT89 and AT90 series. The AT89 series is an 8-bit Flash microcontroller, compatible with the 8051 series microcontroller, with a static clock mode; the AT90 series microcontroller is an enhanced RISC structure, fully static working mode, and built-in online programmable Flash microcontroller, also called AVR microcontroller.
PHLIPIS 51PLC series microcontroller (51 microcontroller):
PHILIPS's single-chip microcomputer is based on the 80C51 core, embedded with power-off detection, simulation, and on-chip RC oscillator functions, which enables 51LPC to meet various performance requirements in high-integration, low-cost, and low-power application designs.
HOLTEK MCU:
Taiwan Shengyang Semiconductor's single-chip microcomputers are cheap and have a wide variety of products, but they have poor anti-interference and are suitable for consumer products.
TI's single-chip microcomputer (51 single-chip microcomputer):
Texas Instruments provides two series of general-purpose microcontrollers: TMS370 and MSP430. The TMS370 series microcontroller is an 8-bit CMOS microcontroller with multiple storage modes and multiple peripheral interface modes, suitable for complex real-time control occasions; the MSP430 series microcontroller is an ultra-low power, high-function integrated 16-bit low-power microcontroller, especially suitable for occasions requiring low power consumption.
SONIX MCU:
It is a single chip from Taiwan Songhan Company, most of them are 8-bit machines, some of them are compatible with PIC 8-bit microcontrollers, cheap, with more system clock frequency division options, PMW ADC internal oscillation and internal noise filtering. Disadvantages: RAM space is too small, and anti-interference is better.
From the world of radio to the world of microcontrollers
The industrial revolution of modern computer technology has brought the world economy from the capital economy to the knowledge economy. In the field of electronics, we have entered the era of intelligent modern electronic systems centered on computer technology from the radio era in the 20th century to the 21st century. The basic core of modern electronic systems is embedded computer systems (embedded systems for short), and single-chip microcomputers are the most typical, widespread and popular embedded systems.
1. The world of radio has produced several generations of talents
In the 1950s and 1960s, the most representative advanced electronic technology was radio technology, including radio broadcasting, radio reception, wireless communication (telegraph), amateur radio stations, radio positioning, navigation and other telemetry, remote control and remote communication technologies. In the early days, it was these electronic technologies that led many young people into the wonderful electronic world. Radio technology showed the wonderful prospects of scientific and technological life at that time. Electronic science began to form an emerging discipline. Radio electronics and wireless communication began the journey of the electronic world.
Radio technology not only became the representative of advanced science and technology at that time, but also attracted a large number of young people from popularization to professional scientific fields, and made them find endless fun in it. From the bedside crystal radio to the superheterodyne radio; from radio transmission to amateur radio stations; from telephones and doorbells to radio-controlled models. Radio technology became the most popular and widespread content of popular science and technology education for young people at that time. To this day, many engineers, experts, and professors of the older generation were radio enthusiasts. The endless fun of radio technology and the comprehensive training of radio technology, from the basic principles of electronics, the basis of electronic components to the production of radio remote control, telemetry, and remote signaling electronic systems, have cultivated several generations of scientific and technological talents.
2. From the Radio Age to the Age of Electronic Technology Popularization
Early radio technology promoted the development of electronic technology, the most important of which was the development of vacuum tube electronic technology to semiconductor electronic technology. Semiconductor electronic technology has made active devices miniaturized and low-cost, making radio technology more popular and innovative, and greatly opening up many non-radio control fields.
The development of semiconductor technology has led to the emergence of integrated circuit devices, which has led to a leap in modern electronic technology. Electronic technology has entered the era of circuit integration from the era of discrete devices. Electronic design engineers no longer use discrete electronic components to design circuit units, but directly choose integrated circuit unit devices to form systems. They are freed from circuit unit design and are committed to system design, which has greatly liberated scientific and technological productivity and promoted the popularization of electronic systems on a wider scale.
Semiconductor integrated circuits first made breakthroughs in basic digital logic circuits. A large number of digital logic circuits, such as gate circuits, counters, timers, shift registers, analog switches, comparators, etc., provide excellent conditions for electronic digital control, allowing traditional mechanical control to shift to electronic control. The development of power electronic devices and sensor technology has enabled the original radio-centric electronic technology to shift to digital control of mechanical systems in the engineering field, information collection in the detection field, and electrical servo drive control of moving mechanical objects.
Semiconductor and integrated circuit technology have brought us into an era of popularization of electronic technology, and radio technology has become a part of the application field of electronic technology.
In the 1970s, the emergence of large-scale integrated circuits promoted the development of special electronic systems for conventional electronic circuit units. Many special electronic system units have become integrated devices, such as radios, electronic clocks, calculators, etc. Electronic engineers in these fields have shifted from careful design and debugging of circuits and systems to device selection and peripheral device adaptation. Electronic technology has developed, electronic products have become more abundant, and the difficulty of electronic engineers has decreased, but at the same time, the charm of radio technology and electronic technology has weakened. The development of semiconductor integrated circuits has made classic electronic systems more and more perfect, and the electronic technology left outside large-scale integrated circuits has been reduced. Electronic technology has lost the endless fun and comprehensive engineering training of the past radio era. [page]
3. From the era of classical electronic technology to the era of modern electronic technology
Entering the 1980s, the most important change in the century economy was the industrial revolution of computers. The most important symbol of the computer industrial revolution is the birth of computer embedded applications. Modern electronic computers were born in response to the requirements of numerical calculations. For a long time, electronic computers have been committed to the development of massive numerical calculations. However, the logical operation, processing, and control capabilities of electronic computers have attracted experts in the field of electronic control, who require the development of computer systems that can meet the requirements of control objects and realize embedded applications. If a computer system that meets the requirements of massive data processing is called a general-purpose computer system, then a computer system embedded in an object system (such as ships, aircraft, locomotives, etc.) can be called an embedded computer. Obviously, the technical development directions of the two are different. The former requires massive data storage, throughput, high-speed data processing, analysis, and transmission; while the latter requires reliable operation in the object environment, high-speed acquisition of external physical parameters, logical analysis and processing, and rapid control of external objects. In the early days, people reluctantly combined a general-purpose computer with a data acquisition unit and an output drive circuit to form a temperature control system for a heat treatment furnace. Such a general-purpose computer system cannot be adopted by most electronic systems, and in order to make the general-purpose computer system meet the requirements of embedded applications, it will inevitably affect the development of high-speed numerical processing technology. In order to solve the contradiction in the development of computer technology, in the 1970s, semiconductor experts took a different approach and integrated the basic system of a microcomputer on a chip in accordance with the requirements of computer embedded applications in electronic systems, forming an early single-chip microcomputer. After the advent of the single-chip microcomputer, two major branches of general-purpose computer systems and embedded systems began to appear in the computer field. Since then, both embedded systems and general-purpose computer systems have developed rapidly.
Although there were embedded computer systems modified from general-purpose computers in the early days, the real embedded system began with the emergence of single-chip microcomputers. Because single-chip microcomputers are specially designed for embedded applications, they can only realize embedded applications. Single-chip microcomputers can best meet the environmental requirements of embedded applications, such as chip-level physical space, low price of large-scale integrated circuits, good peripheral interface buses, and instruction systems that highlight control functions.
The single-chip microcomputer has a computer system core and is embedded in the electronic system, laying the foundation for the intelligentization of the electronic system. Therefore, the current widespread use of single-chip microcomputers in electronic systems has enabled the classic electronic system to quickly transition to an intelligent modern electronic system.
4. Single-chip microcomputers ushered in the era of modern electronic systems
1. Single chip microcomputer and embedded system
Embedded systems originate from embedded applications of computers. Early embedded systems were general-purpose computers that were modified and embedded in various electronic systems in object systems, such as ship autopilots and engine monitoring systems. An embedded system is first a computer system. Secondly, it is embedded in an object system to implement data acquisition, processing, status display, output control and other functions required by the object in the object system. Since it is embedded in the object system, the computer of the embedded system does not have the independent form and function of a computer. The single-chip microcomputer is designed entirely in accordance with the requirements of the embedded system, so the single-chip microcomputer is the most typical embedded system. The early single-chip microcomputer was just a computer single-chip integration designed according to the requirements of embedded application technology, so it is a single-chip microcomputer. Subsequently, in order to meet the requirements of embedded applications, the single-chip microcomputer continuously enhanced its control function and peripheral interface function, especially the control function, so the single-chip microcomputer has been renamed as a microcontroller (MCU, Microcontroller Unit) internationally.
2?Modern electronic systems composed of single-chip microcomputers will become mainstream electronic systems
The single-chip microcomputer is a device-level computer system that can be embedded in any object system to achieve intelligent control. It can be as small as micro-machines, such as watches and hearing aids. The low price of the integrated device level, as low as a few yuan or a dozen yuan, is enough to popularize single-chip microcomputers in many civilian home appliances and electronic toys. Modern electronic systems composed of single-chip microcomputers have penetrated into every household and are changing our lives, such as home audio, televisions, washing machines, microwave ovens, telephones, anti-theft systems, air conditioners, etc. The single-chip microcomputer has revolutionized the original electronic system. For example, after the microwave oven is controlled by a single-chip microcomputer, the clock setting, program memory, and power control can be conveniently performed; after the air conditioner is controlled by a single-chip microcomputer, not only the remote control parameter setting is convenient, the operating state changes automatically, but also the frequency conversion control can be realized. At present, many household appliances such as VCD and DVD can only realize their functions after the emergence of single-chip microcomputers.
3?Embedded systems drive the entire electronics industry
At present, in addition to microprocessors and embedded system devices, the electronic components industry is mostly centered around the components industry supporting modern electronic systems, such as buttons for human-computer interaction, LED/LCD display drivers, LED/LCD display units, voice integrated devices, etc., digital sensors, ADCs, data acquisition modules, signal conditioning modules, etc. that meet the requirements of data acquisition channels, DACs, solid-state relays, stepper motor controllers, frequency conversion control units, etc. that meet servo drive control, and various bus drivers and level converters that meet communication requirements.
Driven by embedded systems, the world's electronic components are developing along the path of modern electronic systems that fully meet the requirements of embedded applications. This makes the original space for classic electronic systems smaller and smaller. All kinds of practitioners in electronic systems should turn to the broad road of modern electronic systems as soon as possible.
5. Single-chip microcomputers will create a new generation of electronic elites
If we say that the radio world has produced several generations of elites since the 1950s, then today's microcontroller world will produce a new generation of electronic elites.
1. Single chip microcomputer takes you into the field of intelligent electronics
If the classic electronic system is regarded as a dead electronic system, then the intelligent modern electronic system is an electronic system with "life". The hardware structure of the single-chip microcomputer application system gives the electronic system a "body", and the application program of the single-chip microcomputer application system gives it "life". For example, when designing the display function of the intelligent instrument display, the system self-test results can be displayed when the machine is turned on, various standby states can be displayed when not in operation, the operation process can be displayed when the instrument is running, and the current results, self-test results, original data, various processing reports, etc. can be displayed after the work is completed. When unattended, various automatic operation functions can be given.
The intelligence of electronic systems is endless, and various innovative functions can often be realized without adding hardware resources. This is also one of the reasons why many home appliances have added a lot of functions.
2? Single chip microcomputer takes you into the field of computer industrial control
The 21st century is the century when all mankind enters the computer age. Many people are either making computers or using them. Among those who use computers, only those who are engaged in embedded system applications can truly enter the internal software and hardware system of the computer system, and can truly understand the intelligent nature of computers and master the knowledge of intelligent design. Starting from learning single-chip microcomputer application technology is one of the best ways to cultivate computer application software and hardware technical talents today.
3? Single chip microcomputer takes you into the most attractive electronic world
The unique single-chip microcomputer can make you realize the true meaning of computers. You can use single-chip microcomputers to design smart toys by yourself, and you can design different applications to achieve different functions. There are both hardware production and software design, which requires both thinking and hands. At the elementary level, you can develop smart toys and program them with macro instructions. At the intermediate level, you can develop some smart controllers, such as computer mice, smart cars, and various remote control models. At the advanced level, you can develop robots, such as robot football games, develop industrial control units, network communications, etc., and design applications in assembly language or high-level languages. The future of the electronics industry formed around single-chip microcomputers and embedded systems will provide a broad world for electronics enthusiasts, an electronic world that is broader, richer, more lasting, and more attractive than the radio world of the past. Investing in the world of single-chip microcomputers will benefit you for life.
MCU attack technology
At present, there are four main technologies for attacking MCUs, namely:
(1) Software Attack
This technique usually uses the processor communication interface and exploits the security loopholes in the protocol, encryption algorithm or these algorithms to attack. A typical example of successful software attack is the attack on the early ATMEL AT89C series of microcontrollers. The attacker took advantage of the loopholes in the timing design of the erase operation of this series of microcontrollers, and used a self-written program to stop the next step of erasing the program memory data on the chip after erasing the encryption lock bit, thereby turning the encrypted microcontroller into an unencrypted microcontroller, and then used the programmer to read out the program on the chip.
(2) Electronic detection attack
This technology usually monitors the analog characteristics of all power supplies and interface connections of the processor during normal operation with high time resolution, and implements attacks by monitoring its electromagnetic radiation characteristics. Because the microcontroller is an active electronic device, when it executes different instructions, the corresponding power consumption also changes accordingly. In this way, by using special electronic measuring instruments and mathematical statistical methods to analyze and detect these changes, specific key information in the microcontroller can be obtained.
(3) Fault Generation Technology
This technique uses abnormal operating conditions to cause the processor to fail, which then provides additional access to conduct the attack. The most widely used fault-generating attack methods include voltage shock and clock shock. Low-voltage and high-voltage attacks can be used to disable protection circuits or force the processor to perform incorrect operations. Clock transient jumps may reset protection circuits without destroying protected information. Microcontroller and clock transient jumps can affect the decoding and execution of single instructions in some processors.
(4) Probe technology
This technology directly exposes the internal wiring of the chip, and then observes, manipulates, and interferes with the semiconductor to achieve the purpose of the attack. For convenience, people divide the above four attack techniques into two categories. One is an invasive attack (physical attack), which requires destroying the package, and then uses power test equipment, microscopes, and micropositioners to spend hours or even weeks in a special laboratory to complete. All microprobe techniques are invasive attacks. The other three methods are non-invasive attacks, and the attacked microcontroller will not be physically damaged. In some cases, non-invasive attacks are particularly dangerous because the equipment required for non-invasive attacks can usually be made and upgraded, so it is very cheap.
Most non-invasive attacks require the attacker to have good processor knowledge and software knowledge. In contrast, invasive probe attacks do not require much initial knowledge and can usually use a similar set of techniques against a wide range of products.
The general process of MCU intrusion attack
The first step of an invasive attack is to remove the chip package. There are two ways to achieve this goal: the first is to completely dissolve the chip package to expose the metal wiring. The second is to remove only the plastic package on the silicon core. The first method requires the chip to be bound to a test fixture and operated with the help of a binding station. In addition to the attacker's certain knowledge and necessary skills, the second method also requires personal wisdom and patience, but it is relatively easy to operate.
The plastic on the chip can be peeled off with a knife, and the epoxy resin around the chip can be etched away with concentrated nitric acid. Hot concentrated nitric acid will dissolve the chip package without affecting the chip and the connection. This process is generally carried out under very dry conditions, because the presence of water may corrode the exposed aluminum wire connection.
Next, the chip is cleaned in an ultrasonic bath with acetone to remove residual nitric acid, then cleaned with water to remove salt and dried. If there is no ultrasonic bath, this step is usually skipped. In this case, the surface of the chip will be a little dirty, but it will not affect the operation of the chip by ultraviolet light. The last step is to find the location of the protection fuse and expose it to ultraviolet light. Generally, a microscope with a magnification of at least 100 times is used to trace the connection from the programming voltage input pin to find the protection fuse. If there is no microscope, a simple search is performed by exposing different parts of the chip to ultraviolet light and observing the results. During operation, the chip should be covered with opaque paper to protect the program memory from being erased by ultraviolet light. Exposing the protection fuse to ultraviolet light for 5 to 10 minutes can destroy the protection of the protection bit. After that, the contents of the program memory can be directly read out using a simple programmer.
For microcontrollers that use a protective layer to protect the EEPROM cells, it is not feasible to use UV light to reset the protection circuit. For this type of microcontroller, microprobe technology is generally used to read the memory contents. After the chip package is opened, the data bus connecting the memory to the rest of the circuit can be easily found by placing the chip under a microscope.
For some reason, the chip lock bit does not lock access to the memory in programming mode. Exploiting this flaw, placing the probe on the data line will allow you to read all the desired data. In programming mode, restarting the read process and connecting the probe to another data line will allow you to read all the information in the program and data memory.
Another possible attack method is to use microscopes and laser cutters to find the protection fuse, and then find all the signal lines connected to this part of the circuit. Due to the design flaw, as long as a certain signal line from the protection fuse to other circuits is cut off, the entire protection function can be disabled. For some reason, this line is very far away from other lines, so using a laser cutter can completely cut this line without affecting the adjacent lines. In this way, the contents of the program memory can be directly read out using a simple programmer.
Although most common MCUs have the function of protecting the internal code by blowing the fuse, since general low-end MCUs are not positioned to make security products, they often do not provide targeted preventive measures and have a low security level. In addition, MCUs are widely used in a wide range of occasions, with large sales volumes, frequent commissioned processing and technology transfer between manufacturers, and a large amount of technical information leaked, making it easier to exploit the design loopholes of such chips and the manufacturer's test interface, and to read the internal program of the MCU by means of invasive attacks or non-invasive attacks such as modifying the fuse protection bit.