51 MCU learning experience and 51 MCU pull-up resistor experience

Publisher:WanderlustSoulLatest update time:2021-05-14 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Reference address:51 MCU learning experience and 51 MCU pull-up resistor experience

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

51 single chip microcomputer automatic water vending machine
  The microcontroller source program is as follows: #include "stc.h" #include "button.h" #include "smg.h" #include "AT24C02.h" sbit led1=P0^0; sbit bell=P0^6; sbit relay=P0^4;   unsigned char flag_s7,flag_s6; int money=0,amount=0;//price capacity unsigned char count,flag_count; unsigned char state; //Control the t
[Microcontroller]
51 single chip microcomputer automatic water vending machine
Design of robot with road learning and memory based on AT89C51 microcontroller
With the continuous development of science and technology, robot technology has been widely used and developed in aerospace, marine, military, construction, transportation, industry and service industries. In some special occasions (such as aerospace, deep-sea operations, nuclear industry, etc.), robotic technologies
[Microcontroller]
Design of robot with road learning and memory based on AT89C51 microcontroller
C8051F350 single chip microcomputer in the full automatic CCFL film viewer brightness
introduction Since the beginning of the 21st century, the world of information has changed rapidly. Maybe a high-tech product will be released today and a better similar product will be released tomorrow. The update cycle of electronic computer science and technology is about 2 to 3 years. With the development
[Microcontroller]
Design and implementation of infrared remote control password lock based on 51 single chip microcomputer
1 Introduction According to the requirements and needs of users, this infrared remote control password lock system is designed mainly to solve the problem of no remote control password lock in the current market, to improve the reliability and security of the access control system, and to meet the needs of the
[Microcontroller]
Design and implementation of infrared remote control password lock based on 51 single chip microcomputer
Serial communication between 51 microcontroller and PC
The serial port control register of the microcontroller is SCON, and its format is as follows: The serial port has four working modes, namely 00, 01, 10, and 11. Mode 0 is a synchronous shift register, and modes 1, 2, and 3 are asynchronous 10, 11, and 11-bit transceiver modes. Mode 1, i.e. 10-bit asynchronous trans
[Microcontroller]
Calculator assembly language based on 51 single chip microcomputer
The calculators we talked about before were all based on C language. Next, let’s talk about a simple calculator based on assembly language. hardware design The display is still a digital tube, and the MCU is C51, which supports integer calculation. Simulation diagram: programming YJ EQU 50H ;Result storage YJ1 E
[Microcontroller]
Calculator assembly language based on 51 single chip microcomputer
Research on Error Detection Method in Serial Communication of 8051 Single Chip Microcomputer
0 Introduction For the 8051 chip structure based on the flash controller, generally, when performing data transmission, the data is first transmitted to the buffer of the flash controller through the serial port. Since the buffer size is 512 bytes, the maximum amount of data transmitted each time is 512 byt
[Microcontroller]
A simple design of electronic password lock based on 51 single chip microcomputer
  1 Background and design features of single chip electronic password lock   With the rapid development of high technology today, people have invented various forms of locks, such as password locks, electronic locks and laser locks. Based on traditional keys, these locks use magnetic fields, sound waves and light be
[Microcontroller]
A simple design of electronic password lock based on 51 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号