SCM PIN, can be controlled by the program, output high, low level, these can be considered as the output voltage of the microcontroller.
However, the output current of MCU is not controlled. The output current of the microcontroller is largely dependent on the external device on the PIN.
Single-chip microcomputer output low-level, will allow the external device, to the single-chip microcomputer pin into the current, this current, called "Sink current", external circuit called "sink current Load";
MCU output high level, it allows external devices, from the microcontroller pin, pull the current, this current, called "Pull current", external circuit called "pull current Load".
What are these currents generally? What is the maximum? This is the common single-chip microcomputer output drive capability problem.
The early 51 series microcontroller with load capacity, is very small, only with "can drive how many TTL input" to illustrate.
P1, P2 and P3 ports, each pin can be driven 3 TTL input, only the ability of P0 mouth, it can drive 8!
Analysis of the TTL input characteristics, you can find that 51 monolithic microcomputer basically has no driving ability.
Its pin can not even drive the LED at that time to normal glow.
Remember it is in the AT89C51 single-chip computer popular, do and the Tao only found that: the ability of the single-chip computer is greatly enhanced, you can directly drive LED light.
See, the figure of D1, D2 can not be driven by other devices, directly from the microcontroller pin control light display.
Although the pin has been able to directly drive the LED light, but wait, don't be too happy, or look at the output of the AT89C51 SCM pin Power Bar.
As can be seen from the PDF manual file of the AT89C51 microcontroller, the upper limit of the "sink current" when the steady-state output is:
maximum IOL per port pin:10 MA;
maximum IOL per 8-bit port:port 0:26 mA,Ports 1, 2, 3:1 5 MA;
maximum total I for all output pins:71 MA.
Here is the saying:
Each individual pin, when the output is low, allows the external circuit, the maximum current to be poured into the pin is ten MA;
Each 8-bit interface (P1, P2, and P3) allows the total current to be poured to the pin at a maximum of up to Ma, while the P0 is more capable, allowing the maximum total current to be poured into the pin at
The sum of the allowable sink currents for all four interfaces, up to a maximum of four mA.
And when these pins "output high", the microcontroller "pull the current" capability? It is too bad to be less than 1 MA.
The conclusion is: when the MCU output low level, the driving ability is fair, and the output high level, there is no output current capacity.
This conclusion is made in accordance with the data given in the manual.
51 single-chip microcomputer these characteristics, is derived from the internal structure of the PIN, the internal structure of the PIN is not drawn here, many books have.
Inside the chip, between the pin and the ground, there is a transistor, so the pin has the ability to pull down, the output is low, allowing the 10mA of the current, and between the pin and the positive supply, there is a hundreds of k "internal pull-up resistor", so, when the pin at high level, can output the pull current is very small. In particular, the P0 port has no pull-up resistors at all, so the P0 port does not have the ability to output current at a high level.
And look at the circuit diagram above:
The D1 in the figure, is connected between the positive power supply and the pin, which belongs to the sink load, D1 when the microcontroller output low level of light. This luminous current can be controlled by a resistor within ten MA.
Figure in the D2, is connected between the pin and the ground, which belongs to the pull current load, D2 should be in the microcontroller output high level when the glow. However, the microcontroller at this time almost no output capacity, must adopt the external "pull-up resistor" method to provide the current required by the D2.
Oh, understand, if the external circuit is "pull the current load", requires the MCU output high power to play a role, it must use "pull-up resistor" to assist, to generate the load required by the current.
The following is a talk about the problem of the pull-up resistor.
As can be seen from the above figure, the D2 glow, is provided by the pull-up resistor R2 current, the D2 conduction light voltage of about 2V, then the luminous current is: (5-2)/1K, about 3mA.
did you notice? When the LEDs do not glow, the pull-up resistor gives a greater current! And, this is larger than the normal luminous current, all poured into the single-chip computer pin!
Oh, especially now, are advocating energy-saving emission reduction, low carbon ....
So, can you increase the pull-up resistor?
The answer is: no, because it needs to provide current to pull the current load. For LEDs, if you increase the resistance, the current will be too small, light-emitting dim, the effect of the loss of light-emitting diodes.
For D1, is the sink current load, the microcontroller output low level, the R1, D1 on the road will have the sink current, the output high level, that is what the current is not, at this time does not generate additional power consumption.
In summary, the current load is reasonable, while the "Pull current load" and "pull-up resistor" will produce a large invalid current, this circuit is unreasonable.
Some netizens on the pull resistance, useful useless, want to install a pull-up resistor on the pin, and even can say some reasons: stability, speed ....
In fact, the "pull-up resistor" and "pull the current load" circuit, will be a single-chip microcomputer system can cause undesirable consequences.
To do but the road to see a lot about the microcontroller pin and pull-up resistance of books, reference materials, basically they are the use of the pull-up resistance of the shortcomings are not discussed carefully.
In this, do and discuss the road solemnly to everyone put forward suggestions: Design single-chip load circuit, should use "Sink current load" circuit form, to avoid unnecessary current consumption.
Pull-up resistor, is only in the P0 eloquence considerations add no problem: When using P0 mouth as input, need to add, when using P0 output high-level driver MOS load, also need to add, other time, the P0 mouth also do not have to add pull-up resistor.
In other interfaces (P1, P2 and P3), the pull resistor should not be added, especially when the output low level is active, the external device has pull-up effect.
About 51 MCU IO pin drive capability and pull-up resistor