This article is original by purplesword (jzj1993). For more information, see. Original web site http://blog.csdn.net/jzj1993
This section describes how to identify the PIN numbers of an integrated circuit. Here we will briefly understand the specific functions of 40 pins of 51 single-chip microcomputer. Readers who have never been familiar with complex electronic components may feel very difficult, but they do not need to be afraid.
According to the pin Identification Method of the integrated circuit, the gap is facing up, turning a circle counter-clockwise, and the pin number of the single chip microcomputer ranges from 1 to 40 ,. The name of each pin is also given in the figure. We don't need to remember the order and name of these pins at all. You just need to check them when you need them. If you use more pins, you will naturally remember them later.
According to the braces in the figure, we set p0.0 ~ Seven pins are called a group of I/O ports, which are also P1, P2, and P3. I/O port (I/O = input/output), as the name suggests, is the input/output interface, which is a way for information exchange between the microcontroller and the outside world. Later, we will focus on the I/O port. In addition to 32 I/O ports, there are eight pins: 29 ~ The 31st foot is rarely used and will not be introduced for the time being; 40-foot VCC, 20-foot Gnd, 9-foot rst, and 18, 19-foot xtal1, xtal2 will soon be detailed in the following single chip microcomputer minimum system.
What is the minimum single-chip microcomputer system? The smallest system refers to the simplest circuit in which the microcontroller can work normally. For 51 single-chip microcomputer, the minimum system generally includes: power supply, single-chip microcomputer, clock circuit and reset circuit. The circuit diagram is as follows:
I would like to introduce the functions of these circuits.
Power supply circuit: as an electronic device, 51 single-chip microcomputer is of course indispensable for power supply, it generally uses 5 V power supply, we can get 5 V power from the USB interface that everyone is familiar. In the figure, each VCC symbol is connected to the positive pole of the 5 V power supply, and all Gnd symbols are connected to the negative pole of the power supply. Instead of connecting them together, the figure uses multiple VCC And Gnd symbols to make the circuit diagram clearer and more concise (VCC = volt current condenser, indicating the power supply voltage; Gnd = ground, ground can be simply understood as the connection to the negative power supply, and we use Gnd as the reference voltage, the Gnd voltage value is always 0 V ).
Special note: do not connect the single-chip microcomputer to a high voltage, or reverse the positive and negative power supply. It is very likely that the single-chip microcomputer may burn out or even explode. If the single-chip microcomputer is inserted in the chip socket, because the VCC And Gnd are just in the symmetric position, the reverse insertion will happen just when the power supply is reversed, be sure to avoid.
Here, if you need to know the power supply voltage of a chip, you can generally refer to the official chip manual, which will be introduced later.
Clock Circuit: the circuit connected between xtal1, xtal2, And Gnd is a clock circuit (xtal = external crystal oscillator, indicating an external crystal oscillator ). The front power supply is better understood, but what is a clock circuit? What is its usefulness? The clock circuit is like a human heart, which keeps beating every moment. It is very important for single-chip microcomputer. As the heart gives our body Continuous Transportation of blood and oxygen, so that all kinds of organs in the body work normally, and the clock circuit is the driving force of the normal operation of each part of the circuit in the single chip microcomputer.
The clock circuit consists of a crystal oscillator and a capacitor. A crystal oscillator is an electronic component made of Z. when the power is on, the surface of the crystal oscillator oscillates at a specific frequency. At last, a clock signal with a very stable frequency can be output through the circuit, driver MCU. Our hearts beat dozens to hundreds of times every minute, but it is too slow for single chip microcomputer. The crystal oscillator frequency in the figure is 12 MHz (1 MHz = 1,000,000Hz). It operates normally and oscillates 12,000,000 times per second! In fact, the crystal oscillator of the clock circuit does not have to be 12 m, or it can be other, however, you must note that the maximum operating frequency of the single-chip microcomputer: can not exceed 80 m (this can also be found through the chip Manual ). In fact, we use more of the 11.0592m crystal oscillator. Why is this strange frequency? When talking about the serial port, I believe the reader will understand it.
The Clock Circuit also uses the C2 and C3 capacitors. If you do not know the capacitance, you can look for information about commonly used electronic components. These two capacitors are usually made of porcelain slice Capacitors with a capacity of 30 PF.
By the way, if you design your own clock circuit, the line between the crystal oscillator and the single-chip microcomputer should not be too long, this may cause the circuit to fail to work normally (cannot start vibration ).
The time at which the clock oscillates every time is called a clock cycle. For the 51 Single-Chip Microcomputer we use, each 12 clock cycles, the single-chip microcomputer performs one step operation, it is called a machine cycle (STC also launched a 1 T single-chip microcomputer, each one-step operation of the clock cycle ). For a 12 m crystal oscillator, the clock cycle is 1/12 us, and the machine cycle is exactly 1 us.
We should remember the old and huge computation in the last century called enica. enica was able to perform 5000 addition operations in one second, which was already quite high. However, compared with our 51 single-chip microcomputer, it is really dumb. 51 single-chip microcomputer can carry out an addition operation (Assembly command Add) in a machine cycle, with a 12 m crystal oscillator, a maximum of 1 million addition operations can be performed in one second, it is 200 times that of enica (not considering the movement of data between registers and memory ). Are you enjoying yourself using such a high-tech thing? Pai_^
Reset Circuit: the circuit connected to the RST pin in the figure is the reset circuit, which consists of resistance and capacitance. The function of the reset circuit is to send a signal to the single-chip microcomputer when it is just powered on (for 51 single-chip microcomputer, it is at least two consecutive high-level machine cycles), telling the single-chip microcomputer can now start to work. As a result, the microcontroller starts from the initial state and tirelessly executes the specific program until the power is down or the program is terminated due to special circumstances. Generally, when the microcontroller works normally, the program execution should not be terminated. In this case, the characteristics of the Microcontroller program will be described later.
The principle of the reset circuit is to charge the capacitor through the resistor during power-on, so that the voltage of the capacitor connected to the RST pin is changed from 5 V to 0 V, that is, the high level to the low level. The value of resistance and capacitance can be determined based on the reference value given in the figure. If you have an understanding of the analog circuit, you can also calculate and determine its value.
In addition, the EA/VPP pins in the figure are used to access the internal or external program memory to select signals and provide programming voltages. Connect directly to VCC.
In practice, I found that the single-chip microcomputer is not connected to the reset circuit, and the two capacitors on the crystal oscillator are omitted, which can also work normally. However, for the sake of security, you should connect these items if necessary. We need a rigorous scientific attitude.
With the smallest system, the single-chip microcomputer can work normally and continuously execute the program we want it to execute. Single-chip microcomputer is worth learning.
Single-Chip Microcomputer entry guide series (6) Minimum single-chip microcomputer system-although the sparrow is small