Brief introduction of single-chip microcomputer and microcontroller pin

1. What can a microcontroller do?

At present, the single-chip microcomputer penetrates into various fields of our lives, and it is almost difficult to find which field has no trace of the single-chip microcomputer. Small to phone, toy, mobile phone, all kinds of credit card machines, computer keyboards, color TVs, refrigerators, air conditioners, induction cookers, large cars, industrial automation, robots, missile navigation devices, and even American Mars rover, these devices contain One or more microcontrollers. The number of microcontrollers is not only far more than PCs, even more than the number of humans. Therefore, the learning, development and application of single-chip microcomputers will create a large number of hardware and software engineers.

Brief introduction of single-chip microcomputer and microcontroller pin

2. What are the basic conditions for learning a microcontroller?

Analog circuit, digital circuit foundation, have a certain understanding of C language or assembly language. Of course, these can also be mastered in the learning process. This set of tutorials are explained.

Hardware conditions: one computer, one experimental development platform.

3, the structure of the microcontroller

A working computer must have several parts: CPU (operation, control), RAM (data storage - memory), ROM (program storage), input / output devices (for example: serial port, parallel output Mouth, etc.). These parts are divided into a number of chips on a personal computer and a printed circuit board called a motherboard is mounted. In the MCU, these parts are all implemented in an integrated circuit chip, so it is called a single chip microcomputer.

The MCU is a control chip, a tiny computer, plus crystal oscillator, memory, address latch, logic gate, seven-segment decoder (display), buttons (similar to the keyboard), expansion chip, interface, etc. system.

day! The CPU in the PC has to sell thousands of dollars, so many things together, you can't buy a sky-high price! Besides, this chip is also very large.

No, the price is not high, from 1 yuan to tens of yuan, the volume is not large, generally 40-pin package, of course, more functions than some microcontrollers have more pins, such as 68 pins, only 10 of the functions Multiple or more than 20 pins, and some even only 8 pins.

Why is this so?

There are strengths and weaknesses in the function. For example, a set of combo speakers on the market sells hundreds of dollars, but some amplifiers sell thousands of them. In addition, the production of this kind of chip is very large, and the technology is very mature. The 51 series of single-chip microcomputers have been done for more than ten years, so the price is low.

In this case, the function of the microcontroller is definitely not strong, why should we learn it? This can't be said. In actual work, it is not that any computer that requires a computer requires high performance. Can a computer that controls the temperature of a refrigerator use a desktop computer? The key to the application is to see if it is enough and whether it has a good performance-price ratio. Therefore, the 8051 has been out for more than ten years and has not been eliminated. It is still in constant development.

4, the relationship between MCS51 microcontroller and 8051, 8031, 89C51, etc.

We usually talk about 8051, what is 8031, and now there is 89C51, 89s51 What is the relationship between them?

MCS51 refers to the general name of a series of single-chip microcomputers produced by INTEL Company of the United States (right, the famous INTEL). This series of single-chip microcomputers includes many varieties, such as 8031, 8051, 8751, 8032, 8052, 8752, etc., of which 8051 is The earliest and most typical products, the other single-chip microcomputers in this series are based on the addition, subtraction and change of functions on the basis of 8051, so people are used to calling the MCS51 series single-chip microcomputer with 8051, and the 8031 ​​is the most in China in previous years. Popular microcontrollers, so many occasions will see the name of the 8031.

INTEL has licensed (sold) the core technology of MCS51 to many other companies, so many companies are doing 8051-based microcontrollers. Of course, the functions are more or less changed to meet different needs, of which 89C51 is this. A few years in China, very popular microcontroller, we will use 89C51 microcontroller to complete a series of teaching experiments. If you have any mistakes, please criticize and correct in this article.

5. Does the compilation still learn C language?

It is very important to master the programming with C language MCU. After all, C is easy to write, has good readability and strong portability. But the C language is still not enough, you have to understand the assembly, in fact, not to understand the assembly instructions, but to understand the architecture of the microcontroller. It can be said with certainty that the best C-language MCU engineers are programmers who come out of the compilation, so I thought that learning MCU, it is necessary to learn the assembly first, but in the future development, the C language is mainly used, so this series The tutorial will take both the assembly and the c language.

The 40 pins of a microcontroller can be roughly divided into four categories: power, clock, control, and I/O pins.

1. Power supply:

(1) VCC - chip power supply, connect +5V; (2) VSS - ground terminal;

2. Clock:

XTAL1, XTAL2 - Inverting input and output of the crystal oscillator circuit.

3. Control line:

There are 4 control lines

(1) ALE/PROG: Address Latch Enable / On-chip EPROM Programming Pulse

1 ALE function: used to latch the low 8-bit address sent by P0. 2 PROG function: Chip with EPROM on chip. During EPROM programming, this pin inputs programming pulse.

(2) PSEN: External ROM read strobe signal.

(3) RST/VPD: Reset/standby power.

1 RST (Reset) function: reset signal input. 2 VPD function: Connect the backup power supply when Vcc is powered off.

(4) EA/Vpp: internal and external ROM selection / on-chip EPROM programming power supply.

1 EA function: internal and external ROM selection. 2 Vpp function: Chip with EPROM on chip, during programming of EPROM, apply programming power supply Vpp.

4. I/O line

The 80C51 has four 8-bit parallel I/O ports: P0, P1, P2, and P3, for a total of 32 pins. The P3 port also has a second function for special signal input and output and control signals (which are control buses).

To get a chip, if you want to use it, you must first know how to connect. We use a chip called 89C51. Let's take a look at how to connect it.

1. Power: This is of course essential. The single-chip microcomputer uses a 5V power supply, in which the positive pole is connected to 40 pins, and the negative pole (ground) is connected to 20 pins.

2, vibrating circuit: MCU is a kind of sequential circuit, must supply pulse signal to work properly, the oscillator has been integrated inside the MCU, using crystal oscillator, connected to 18, 19 feet. Just buy the crystal oscillator, the capacitor, you can connect it, you can connect it according to Figure 1.

3. Reset pin: Connect according to the drawing in Figure 1. As to what is the meaning of reset and why it needs to be reset, it is introduced in the function of MCU.

4. EA pin: The EA pin is connected to the positive power terminal. At this point, a single-chip microcomputer is connected, and the microcontroller is started to work.

Our first task is to use a single-chip microcomputer to illuminate an LED. Obviously, this LED must be connected to a certain pin of the MCU. Otherwise, the MCU can't control it. So which pin is connected? In addition to the five pins that have just been used, there are 35 on the MCU. We connect this LED to the 1 pin. (See Figure 1, where R1 is the current limiting resistor)

According to the connection method of this figure, when the 1 pin is high level, the LED is not lit, and only when the 1 pin is low level, the LED is illuminated. Therefore, we must be able to control 1 foot, that is, we must be able to make 1 pin high or low as required. Now that we have to control 1 foot, we have to give it a name. Can we just call it? What is the name of it? INTEL, which designed the 51 chip, has already started, it is called P1.0. This is a regulation and cannot be changed by us.


figure 1

With the name, how do we make it 'high' or 'low'? Calling people to do things, just say it, this is called issuing a command, to do things on the computer, you have to send commands to the computer, the commands that the computer can understand are called computer instructions. The instruction to make a pin output high is SETB, and the instruction to make a pin output low is CLR. Therefore, we want P1.0 output high level, as long as write SETB P1.0, P1.0 output low level, just write CLR P1.0.

Now we have a way to let the computer output P10 high or low, but how can we execute this command on the computer? I can't talk to the computer anymore. There are still a few steps to go to solve this problem.

First, the computer does not understand instructions such as SETB CLR. We have to translate the instructions into a way that the computer can understand, and then let the computer read. What can a computer know? It only knows one thing - the number. So we have to change SETB P1.0 to (D2H, 90H) and CLR P1.0 to (C2H, 90H), as to why these two numbers, which are also specified by the 51 chip designer - INTEL We are not going to study.

The second step, after getting these two numbers, how to make these two numbers enter the inside of the microcontroller? This relies on a hardware tool "programmer". If you still don't know what a programmer is, let me introduce it, that is, the code that you write on the computer is written to the eprom of the microcontroller by a compiler and other objects generated by the compiler, 80c51 This type of MCU programming is a very cumbersome task. It must be programmed on the programmer before it can be used on the device. The latest AT89s51 or STC89C51 MCU can support the online programming (isp) function without using it. A simple circuit can be used to write code into the microcontroller.

Let's take a look at the following: The software shown in the following figure (Figure 2) is called keil —> Click here to download the program code and generate a Hex file that can be written to the microcontroller chip (we only want to control the microcontroller) Can use assembly language or C language and the microcontroller does not know how to do it? So keil this software will convert the programming language into a specific format Hex file, as long as this file is downloaded to the microcontroller chip microcontroller will follow our program ideas To run)


Figure 2 (keil programming software)

Brief introduction of single-chip microcomputer and microcontroller pin
Figure 3 (download software)

Ok..., we compile the assembly statement of SETB P1.0 with keil software to generate Hex file, and then download it to us with the software shown in Figure 3 and the hardware shown in Figure 1 (connected to the computer with serial port). On the circuit board of the microcontroller chip (to save trouble if you want to buy a development board directly), and then turn on the power ... What? Light does not shine? That's right, because the instructions we write in are to let P10 output a high level, of course the light does not light, if it is bright, it is wrong. So change the content of the keil compilation area to CLR P1.0, recompile and generate the Hex file, re-download, power on, well, the light is on. Because the Hex we write is the instruction that makes P10 output low. In this way, we can see that the connection of the hardware circuit has not been changed. As long as the content written in the microcontroller is changed, the output of the circuit can be changed.

Wire Condenser

Wire Condenser

The condensing unit is used for refrigerator temperature control devices, air conditioners, heat pumps and coolers. They are called [gas refrigerants" by compression in the form of heat, then pumped through the coil system, and heated and cooled by the coiled air. The condenser unit is mainly used in commercial refrigeration systems and industrial refrigeration systems. The condensing unit mainly consists of Mono-Blocks For Cold Storage,Semi Hermetic Condensing Unit,Box Type Condensing Unit ,we can follow the customer's requirements to produce the correct size of the condensing unit.

Wire Condenser,Cold Room Condenser,Evaporator Condenser,Refrigerator Condenser

FOSHAN SHUNDE JUNSHENG ELECTRICAL APPLIANCES CO.,LTD. , https://www.junshengcondenser.com