Analysis of the driving capability and pull-up resistor of 51 series MCU IO pins

Publisher:未来画家Latest update time:2011-08-09 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When the microcontroller outputs a low level, external devices are allowed to input current into the microcontroller pins. This current is called "injection current" and the external circuit is called "injection current load". When the microcontroller outputs a high level, external devices are allowed to pull current out from the microcontroller pins. This current is called "source current" and the external circuit is called "source current load".

What are the typical currents? What is the maximum limit? This is a common question about the output drive capability of a microcontroller.

The load capacity of the early 51 series microcontrollers was very small, and was only described by "how many TTL inputs it could drive". Each pin of the P1, P2 and P3 ports can drive 3 TTL inputs, and only the P0 port has a strong capacity, which can drive 8!

If we analyze the input characteristics of TTL, we can find that the 51 MCU basically has no driving capability. Its pins can't even drive the LEDs at that time to emit light normally. I remember that it was only after the AT89C51 MCU became popular that we found that the pins of MCUs had been greatly enhanced and could directly drive LEDs to emit light
.

See the figure below. D1 and D2 in the figure can be directly controlled by the pins of the microcontroller to emit light without going through other driving devices.

Although the pins can directly drive the LED to emit light, wait a minute, don't be too happy, let's take a look at the output capability of the AT89C51 microcontroller pins.
From the PDF manual of the AT89C51 microcontroller, we can see that in steady-state output, the upper limit of the "sink current" is:

Maximum IOL per port pin: 10 mA;
Maximum IOL per 8-bit port:Port 0: 26 mA,Ports 1, 2, 3: 15 mA;
Maximum total I for all output pins: 71 mA.

What this means is that
when each single pin outputs a low level, the external circuit is allowed to sink a maximum current of 10 mA into the pin;
each 8-bit interface (P1, P2, and P3) allows a maximum total current of 15 mA to be injected into the pin, while P0 is more capable and allows a maximum total current of 26 mA to be injected into the pin;
the maximum total current allowed by all four interfaces is 71 mA.

When these pins "output high level", what about the "current source" capability of the microcontroller? It can be said to be too poor, less than 1 mA.

The conclusion is: when the microcontroller outputs a low level, the driving capability is acceptable, but when it outputs a high level, it has no ability to output current.
This conclusion is based on the data given in the manual.

These characteristics of the 51 MCU are derived from the internal structure of the pins. I will not draw the internal structure diagram of the pins here, as it can be found in many books.
Inside the chip, there is a transistor between the pin and the ground, so the pin has the ability to pull down. When the output is low, it allows 10mA of current to be injected; and there is an "internal pull-up resistor" of several hundred K between the pin and the positive power supply, so when the pin is at a high level, the pull-up current that can be output is very small. Especially for the P0 port, there is no pull-up resistor inside, so the P0 port has no ability to output high-level current.

Let's look at the circuit diagram above:
D1 in the figure is connected between the positive power supply and the pin, which is a current sink load. D1 emits light when the microcontroller outputs a low level. The current of this light can be controlled within 10 mA by a resistor.
D2 in the figure is connected between the pin and the ground, which is a current pull load. D2 should emit light when the microcontroller outputs a high level. However, the microcontroller has almost no output capability at this time, and an external "pull-up resistor" method must be used to provide the current required by D2.

Oh, I see. If the external circuit is a "current-pulling load" and requires the microcontroller to function when outputting a high level, then a "pull-up resistor" must be used to assist in generating the current required by the load.

The following discussion will specifically talk about the problems with pull-up resistors.

As can be seen from the figure above, D2 emits light due to the current provided by the pull-up resistor R2. The voltage when D2 is turned on is about 2V, so the current is: (5-2)/1K, which is about 3mA.

When the microcontroller outputs a low level (0V) and D2 does not emit light, is the pull-up resistor R2 idle? No! The voltage across it is higher than when the LED emits light, now it is 5V, and the current is 5mA!
Did you notice? When the LED does not emit light, the pull-up resistor gives a larger current! And this current, which is greater than the normal light-emitting current, is all poured into the pin of the microcontroller!

If eight 1K pull-up resistors are installed in an 8-bit interface, when the microcontroller outputs a low level, a 40mA current will flow into the 8-bit interface!
If four 8-bit interfaces are all equipped with 1K pull-up resistors, a maximum of 32 × 5 = 160mA of current may flow into the microcontroller!
This value has exceeded the upper limit given in the microcontroller manual. If the microcontroller is unstable at this time, it is natural.
Moreover, these currents all appear when the load is in an invalid state. They are completely useless currents, which only produce heat, high power consumption, fast battery consumption, etc.
Haha, especially now, energy conservation and emission reduction, low carbon... are being advocated .

So, can we increase the pull-up resistor?
The answer is: No, because it is needed to provide current for the current-pulling load. For LEDs, if the resistance is increased, the current will be too small, the light will be dim, and the function of the light-emitting diode will be lost.

For D1, it is a current sinking load. When the microcontroller outputs a low level, there will be current sinking in the R1 and D1 paths. When the microcontroller outputs a high level, there will be no current, and no additional power consumption will be generated.

To sum up, the current sinking load is reasonable, while the "current pulling load" and "pull-up resistor" will generate a large amount of invalid current, and this circuit is unreasonable.

Reference address:Analysis of the driving capability and pull-up resistor of 51 series MCU IO pins

Previous article:Interface Design Technology between TMS320VC5402DSP and 51 Single Chip Microcomputer
Next article:Design of invisible anti-theft net for balcony realized by 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号