1. I never say 51 is the foundation. If I say so, please understand it as microcomputer principles are the foundation.
2. The operation of 51 MCU is essentially the operation of registers, and the same is true for other MCUs. The library is just an interface for the convenience of users.
3. Assembly language is rarely used in work, so just understand it.
4. The P0 port of the 51 microcontroller is very special.
5. C language is C language, 51 single-chip microcomputer is 51 single-chip microcomputer, algorithm is algorithm, peripheral circuit is peripheral circuit, sensor is sensor, communication device is communication device, circuit diagram is circuit diagram, PCB diagram is PCB diagram, and simulation is simulation.
Even though you no longer use 51 in the future, the knowledge of C language and algorithms is still there, the skills to build the minimum system of microcontrollers is still there, the methods to use sensors and communication devices are still there, and you can still draw circuit diagrams and PCB diagrams, and of course you can do simulation.
6. The 51 single chip microcomputer is this:
7. When the program debugging is not satisfactory, calm down and look up the information. The biggest advantage of 51 single-chip microcomputer is that there is a lot of information on the Internet. The problem you encounter must have been encountered by others. As a learner, it may be more convenient to ask others, but you will not be able to develop the ability to solve problems if you keep doing this.
8. Some MCU beginners think that reading routines is not good, and feel guilty just like reading the answers. In fact, for beginners, reading routines, understanding them, and then reading the annotations is the best way to learn. When doing experiments, course designs, and competition works, you can also transplant the program without having to re-implement it yourself. (Of course, it is better to complete the homework assigned by the teacher independently)
However, it is important to understand that porting a program is not the same as learning about microcontrollers. The most important thing is to know the framework and implementation of the routine. Which registers are initialized, which pins are configured, which functions are called, how are those functions implemented, which interrupts are set, which on-chip resources are used (UART, ADC, etc.), which states are queried, and what happens if the state changes (triggering an event), etc. By sorting out a flow chart and knowing how to implement it, you have basically learned the routine.
Summary of pull-up resistors on 51 MCU
(1) Used to provide driving capability for OC and OD gate circuits.
Take the OC (open collector) circuit as an example:
For example, the Darlington tube (actually a compound three-stage tube) integrated block ULN2003. The internal circuit is shown in the figure, which is an open collector circuit.
If you don't add a pull-up resistor, you can't drive other devices at a high level. Because when the transistor is cut off, there is no path for current to flow, let alone drive. This is the same principle as adding a pull-up resistor to the P0 port of the microcontroller.
(2) Increase the high level potential:
The MCU P1 port is connected to a 4×4 matrix keyboard. In addition, P1.0~P1.3 are reused to connect to an external ULN2003 to control the stepper motor.
Problems encountered during the experiment: The keyboard does not work when ULN2003 is connected, but it works fine after ULN2003 is removed. ULN2003 works fine. (Note: the two parts do not work at the same time)
Problem analysis: Due to the structure of the keyboard, it is nothing more than the connection or disconnection of two metal sheets. However, it cannot work properly after connecting to ULN2003, which means that the connection to ULN2003 affects the change of the level of P1 port. The voltage measured by the multimeter shows that when the microcontroller outputs a high level, the voltage of P1.0~P1.3 is about 1V, and the voltage of P1.4~P1.7 is about 4.3V. So the judgment potential of the high and low levels of AT89s52 is measured, which is about 1.3V. In this way, P1.0~P1.3 is always at a low level, and the keyboard cannot realize the scanning function at all.
The solution is to raise the potential of P1 port when it is at a high level, and it can work normally.
1. Connect a resistor in series from P1 to ULN2003 to act as a voltage divider, which can raise the voltage level.
2. Connect a pull-up resistor to the P1 port in parallel with the internal resistor of the P1 port to reduce the resistance of the pull-up resistor and the divided voltage, thereby raising the high-level potential of the P0 port.
The second solution can raise the voltage level to about 2.5V. The keyboard works normally.
In addition: When I was doing the LCD display experiment, the P0 port used for the data line could not work properly and no characters were displayed. However, the display phenomenon was not normal. The characters were not written at one time, but they had to be moved several times to write all the contents. Normally, all of them should be displayed at one time. The reason is that there are six ports in my P0 port, all of which are connected to three LEDs in parallel. Because I found out from the data that each port of the P0 port can absorb a maximum current of 10MA, and the total current cannot exceed 26MA. So my total current has reached 40MA, haha. Sorry for the joke. So I suspected that it was a driver problem. So I removed a few diodes. Everything was displayed normally. It seems that the problem has been solved, but I always feel that there is still a problem. So after several experiments, I found that only when one of the parallel diodes of the P0.7 port is removed and a light-emitting diode is connected to other ports. At this time, it can also display normally. But in this way, the P0 port absorbs 38MA, which is much more than 26MA. So it is not a problem of absorbing too much current. A careful analysis shows that when the port is connected in parallel with three external diodes, it is equivalent to adding a resistor of about 700 ohms. So the diode was removed and replaced with a 1k resistor, but the LCD still could not display.
After careful analysis, I think that since P0.7 is the return line of the LCD busy signal, when this port returns a high level, it means that the LCD is processing data and cannot receive new data. When it returns to 0, it means that it is idle and can receive new data.
In this way, when the pull-up resistor is too small, the LCD may return to a low level and it may be higher than 1.3V (the judgment potential of the high and low levels of AT89s52). After receiving it, the microcontroller will not treat it as a low level, and of course it will not be displayed. (When the program is designed, the busy signal is detected and the detection continues)
Summary: There are also requirements for the selection of pull-up resistors, haha. It is neither the higher the better nor the lower the better. Choose according to your needs.
This may also be called impedance matching.
Previous article:51 single chip microcomputer 8 times 8 dot matrix LED display principle and program
Next article:8051 MCU UART0 serial port initialization
Recommended ReadingLatest update time:2024-11-16 16:01
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Fundamentals and Applications of Single Chip Microcomputers (Edited by Zhang Liguang and Chen Zhongxiao)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Looking for books that explain basic circuits?
- 60W Sensorless BLDC Motor Driver Reference Design
- DGUS T5UID1 implements modbus protocol
- 【Goodbye 2021, Hello 2022】+ My summary of 2021
- Super detailed teaching you to use HFSS to design and simulate inverted F antenna 3
- Keil's optimization is really a rip-off
- [Zero-knowledge ESP8266 tutorial] Quick Start 2- Light up the external LED
- [Embedded Linux] RK3568 Android 11 screen point process
- Xiaoyi H8 camera, V831 vest QG2101
- Negative feedback bandwidth broadening