A Brief Discussion on the Minimum System of Single Chip Microcomputer

Publisher:素心静听Latest update time:2012-03-28 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
MCU Minimum System We already know roughly what a MCU is, so let's officially start learning about MCUs.


Microcontrollers are a very practical course. If you simply learn theoretical knowledge without practicing, it will be difficult to fully master microcontrollers.

Although the microcontroller is an intelligent integrated chip, it is essentially an electronic component. Since it is an electronic component, it must be operated in a certain circuit to realize its function. This is like a resistor. If a resistor is placed independently, it is meaningless. Only when the resistor is connected to the circuit can its function be realized. After all, whether it is voltage division, current division, or current limiting, it depends on the detailed circuit.

Although a single-chip microcomputer integrates many circuits, it still cannot run independently. It must be connected to some external circuits to make the single-chip microcomputer run. This simplest circuit that can make a single-chip microcomputer work is called a single-chip microcomputer minimum system. In Figure 2-1 , the AT has 40 pins . 89C 51 single- chip microcomputer is one of the many models in the single-chip microcomputer family. Why choose this single-chip microcomputer to learn? Because the core of this single-chip microcomputer is MCS - 51 single-chip microcomputer, which is a very classic single-chip microcomputer, simple and easy to learn, and has very rich information. Of course, if there are special needs, you can also choose other single-chip microcomputers to learn.

Without further ado, let's analyze the circuit shown in Figure 2-1 .

First, let's take a look at the clock circuit of the microcontroller, as shown in the red circle above with the word "晶振". The clock circuit of the microcontroller is formed by connecting a crystal oscillator and two 30pF capacitors. The crystal oscillator is a component that can output a stable oscillation cycle, through which the microcontroller can have a concept of time.

However, the crystal oscillator cannot be used independently and must be used with appropriate load capacitors, otherwise errors will occur or the crystal oscillator may not work.

The load capacitor can be selected according to the instructions in the technical documentation of the microcontroller. For 51 microcontrollers, ceramic capacitors of no more than 40pF are generally selected . Since we know that the clock oscillation circuit consists of a crystal oscillator and a crystal oscillator load capacitor, why do we need to add this circuit?

Let’s look at an example:

Under normal circumstances, a person can only do one thing at a certain moment (of course, being half-hearted does not count), but a person cannot do one thing all day, so we have to arrange the things that need to be done in a certain time sequence. So what do we use to divide time? The wise ancient people used sundials to mark time very early. Through the sundial, a day is divided into 12 equal parts, which we often call hours. With the concept of hours, we can easily arrange time. The microcontroller is an intelligent device that can handle many things, so how do we arrange these things?

In order to give the microcontroller a " sundial " , we use a crystal oscillator that can output an oscillating clock. The clock pulses output by the crystal oscillator are used to arrange the work of the microcontroller. Therefore, we can make some arrangements for the microcontroller. When the first clock pulse appears, what does the microcontroller do? When the second clock pulse appears, what does the microcontroller do? ... When the nth clock pulse appears, what does the microcontroller do ? ... Continue to arrange like this, and we can use the microcontroller to achieve what we want to do. From a professional perspective, this arrangement is called programming.

Next, let's look at the reset circuit of the 51 microcontroller, which consists of a 10uF capacitor and a 4.7K resistor. Why is it wired like this? The reason is this: when designing the 51 microcontroller, it is stipulated that the 9th pin of the 51 microcontroller is the reset function pin. When there is a high level on this pin for more than two consecutive machine cycles ( more than 2us ) [Note 2 ], the microcontroller will reset. And our circuit design is that the capacitor is turned on at the moment of charging. At this moment, the current passes through the capacitor and then discharges in the direction of the resistor. At this time, the "-" end of the capacitor can have a very high potential. When it is higher than 3V , it can be considered as a high level. The charging of the capacitor takes time. When a suitable capacitor is selected, its charging time will be greater than 2us . At this time, the reset condition is established. Of course, in order to achieve a more stable reset, we often control the high level time of the reset pin of the microcontroller to be longer, usually reaching the ms level.

You may ask, why do we need to reset it?

Before I answer your question, let me ask you a few questions in return. If you can answer these questions, you will be able to find your answer.

Question 1 : When you want to do something, where do you want to start? Do you want to start from the very beginning, the middle stage, or the end stage?

Question 2 : When your machine breaks down, do you hope it can return to normal operation?

Obviously, when we start working or when something goes wrong, we all want to return to the original initial state.

Then, our answer is obvious. The function of reset is to enable the microcontroller to return to the set initial working state and start working.

Now that we know the reset and crystal oscillator circuits, let's take a look at the circuit on the right side of the microcontroller. This circuit connects the 31- pin EA of the microcontroller to the power supply VCC terminal.

In the pin definition of the microcontroller, the EA port is the enable terminal for accessing the external memory. Because a horizontal line is added to the two letters "EA" , it means that the low level is valid at this pin. (In digital circuits, this method is often used to indicate that if there is no horizontal line above the letter, it means that the high level is valid, and if there is a horizontal line, it means that the low level is valid.) That is, when the "EA" pin is at a low level, the external memory is directly accessed.

When the EA pin is at a high level, the internal memory is accessed. When the memory address to be accessed exceeds the address range of the internal memory, the corresponding address of the external memory is automatically accessed.

The microcontrollers we are using now and the microcontrollers we are studying have internal memory, and its memory space is 4kb . In order not to waste this storage space, we will directly connect the EA pin to a high level, so that the microcontroller will first run the program in the internal memory. However, there is an exception to this microcontroller, that is, the 8031 ​​microcontroller, which is also based on the 8051 microcontroller core. However, when designing this microcontroller, the memory is not integrated into the microcontroller, and an external memory is required. At this time, the EA pin must be grounded, otherwise, the microcontroller cannot work.

People often say that the MCU is the most important part of the whole system, but I don't think so. Since it is a system, all parts of the system are unified and inseparable. Without any part, the MCU system cannot work properly. Just like in a person, other organs except the brain are not unimportant. In fact, other organs are also very important.

The microcontroller is an electronic device, so it must have a power supply to work. Otherwise, no matter how powerful you are, you are just a small " black centipede monster " that is nothing .

The 51 microcontroller we use needs to work stably in a +5V DC environment (not all microcontrollers work at +5V , some low-voltage microcontrollers work at 3.3V , and some are even lower). In a DC power supply, there are usually two wires, a positive power supply and a ground. The pin for the microcontroller to connect to +5V is 40- pin VCC , and the ground pin is 20- pin GND .

The +5V DC power supply for the microcontroller must be very stable, otherwise it may cause the microcontroller to reset frequently, which must be avoided during the normal operation of the microcontroller, unless there is a specific need or a fault occurs.

MCU clock cycle

Decades ago, due to technical reasons, the speed of microcontrollers was very slow. The clock pulses of the crystal oscillator were too fast for the microcontrollers to execute an instruction with each pulse. In order to solve this problem, our great engineers made a little improvement and set it to execute an instruction only after several pulses appeared. In this way, the speed of the microcontroller could work according to the clock.

It's like seconds are too small for ordinary people like us. It is difficult for us to be accurate to seconds in our daily work. In order to solve this problem, time concepts such as minutes and hours came into being.

In the 51 single- chip microcomputer, the pulse period of the crystal oscillator output is the pulse period, 12 pulse periods are the machine period, and the minimum working time of the single-chip microcomputer is the machine period.

Reference address:A Brief Discussion on the Minimum System of Single Chip Microcomputer

Previous article:Engineers share the steps to learn MCU
Next article:Introduction to Classic MCU Types

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号