Summary of learning experience of 51 single-chip microcomputer

1. The execution model of instruction fetching and decoding: First, let's take a look at how the single-chip microcomputer works. We compare the motherboard of the computer. When we buy a computer, we always pursue the main frequency of the processor. The working principle of the processor is to fetch an instruction from the memory, then decode the instruction, and execute it after decoding. Then fetch the next instruction, decode it, and execute it. Why does it work in such an orderly manner? It is because it has a working clock. Under the unified management of this working clock, the processor works in an orderly manner. The main frequency here is the speed of the working clock. Of course, now you may also know that the higher the main frequency, the faster the instruction fetch and decode. The faster the speed, the better the performance. Then you may ask, what does this have to do with the 51 single-chip microcomputer? But where is the memory of the microcontroller? Inside the single-chip microcomputer, for the computer, the processor and memory are concentrated on a motherboard. Now you should be very clear that for a single-chip microcomputer, it is equivalent to a computer motherboard, which integrates the processor and memory into a single chip. From this macro perspective, are all single-chip microcomputers a principle, subject to the basic model of instruction fetching, decoding, and execution. OK, continue...

3. Configuration register: Learning 51 single-chip microcomputer, whether you are just starting to learn, or you have been learning for a while, you should be familiar with the word, register. I want to say that the basic idea of ​​MCU is five words: configuration register. How does the single-chip microcomputer work, for example, you make the I/O port output high level, how to output, in the C language, you implement it through P1=0xFF, why do you write this, you go to the header file reg51.h. content, it defines a register as P1, and then you write 8 1s to this register, so the output is high. You control the I/O ports through the contents of the configuration registers. Let's think about how you configure the timer. The same principle, you complete it by configuring several registers such as TMOD, TCON, TH, TL, etc., and then set a time for the microcontroller. Of course, you say these are Simple and complicated? Then I will give another example. As long as you write a microcontroller program, you are basically configuring registers. For example, the STC series microcontrollers have PWM functions. How do you make the microcontroller output a PWM signal that meets your requirements? You absolutely By writing a value to a register, this value controls the frequency. Then write a value to a register, this value controls the duty cycle, and then which pin is output, you control it through a register. So the whole thing is control registers. So you say, 51 is like this, what about the others? STM32, a high-end single-chip microcomputer, also works as a configuration register. The selection of the STM32 clock signal is by controlling RCC, and the control of I/O is by controlling GPIO. Of course, it uses the unified addressing of the memory, that is, you define a certain The register is no longer the sfr and sbit of 51, but the way to directly access the address with a pointer, such as accessing a register, and finding the address of the register from the device manual is 0xXXXXXXXX, then use * (long unsigned *) (0xXXXXXXXX) when configuring )=0xFFFFFFFF, the essence remains unchanged. In this way, both msp430 and PIC are like this, but their registers are different, their configuration methods are different, and the written values ​​are different. If you really understand the 51 single-chip microcomputer, you really understand the principle of the single-chip microcomputer configuration register. You only need to spend two hours to read the chip manual, familiarize yourself with the development environment, and you can get started with a new chip in a day... As an aside, the chips such as arm are very high-end. If it is bare metal programming, then it is also a configuration register. The principle The same, of course, adding an operating system is different, the framework of the operating system is important.

4. About the communication protocol: For any single-chip microcomputer, the most difficult problem is the communication protocol. I don’t want to say too much about this problem. After all, I am not doing the communication principle. There is an agreement, what does this mean? It means that when the microcontroller drives any chip, it must obey the timing of the chip, for example, enable the chip first, then give a write signal or a read signal, and then the chip sends a response signal , and then operate the chip. Why do you want to do this? First of all, for the chip, it has its own operation method. If there is no fixed method, it will be messy. When people communicate, if there is no translation, they need to make gestures. Both parties can understand this gesture, so they can communicate. The chip protocol is also the same. Both the microcontroller and the chip can understand, so they can both work. The chip carries the SPI protocol, the IIC protocol, etc. If it comes with it, then the protocol has been set up, returning to the essence, and using this protocol is the configuration register. For example, the serial port protocol of the 51 microcontroller, you pass Configure the register to set the baud rate, the parity bit... the same thing...

48V 50Ah

Some of the harsh environment near the telecommunication base station, such as high temperature and humidity, therefore, the quality of lithium iron phosphate battery is important to prevent the battery from damage. By selecting high quality battery cells and equipping with our own in-house developed BMS, the 48V 50Ah LiFePO4 Battery designed by UFO POWER can be an ideal selection for telecom base station.

Ufo Lithium Battery


Feature of Rack Mount LiFePO4 Battery for Telecom Towers

● Safe LiFePO4 Battery Cells


● Modular Design for Limited Space


● GPRS for Battery Remote Monitoring


● Communication Function


● Flexible capacity scalability

48V Lithium Ion Battery Golf Cart,48V Lithium Ion Battery Solar,48V 50Ah Lithium Ion Battery,Lithium Battery Charger

ShenZhen UFO Power Technology Co., Ltd. , https://www.ufobattery.com