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.
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
- Popular Resources
- Popular amplifiers
- Chip Manufacturing: A Practical Tutorial on Semiconductor Process Technology (Sixth Edition)
- Design of a low voltage low dropout regulator with auxiliary push-pull output stage circuit
- LED Street Light Design 150W Power Supply Design Guide Using FL7930B and FAN7621S
- NE5532,NE5532A,SA5532,SA5532A,pdf(Dual Low-Noise Operational Amplifier)
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
- TouchGFX Design Whack-a-Mole
- [Fudan Micro FM33LC046N Review] + Learning UART0 DMA Transmission and Reception
- What are the abbreviations of h and f in the small signal current amplification factor hfe?
- 【Chuanglong TL570x-EVM】Evaluation 05 Linux Application Development Manual
- Soso will take you to IC China 2020
- The 17th International Medical Device Design and Manufacturing Technology Exhibition invites you to participate!
- Open Source ESP32 Color Screen WIFI/BLE Smart Multimeter Production Process (2. Button Selection)
- Number of Cycles At 60Hz
- [McQueen Trial] The first post of the belated post & the bug that the car cannot drive two wheels in reverse at the same time
- [ESP32-C3-DevKitM-1] BLE for ESP32-C3