51 MCU Summary - Pull-up Resistor

Publisher:素心悠远Latest update time:2016-08-08 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The function of pull-up resistor:

(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.

51 MCU Summary - Pull-up Resistors - Kaige - Software

 

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 in the experiment: The keyboard does not work when ULN2003 is connected, but it works normally after ULN2003 is removed. ULN2003 works normally. (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 divide the voltage and 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 voltage divided, 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 the voltage 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 Summary - Pull-up Resistor

Previous article:51 MCU Summary--C Language Preprocessing
Next article:Circuit design of intelligent humidifier system based on 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号