4263 views|21 replies

6366

Posts

4937

Resources
The OP
 

Let's see what's wrong with this circuit. [Copy link]

 
I saw such a circuit on the Internet. The title of the post is "A simple question about the working principle of strong pull-up". The circuit diagram is as follows The content of the post is as follows. "I've never figured out this circuit. How come the light turns on when P2.0 outputs a high level? When P2.0 outputs a high level, aren't VCC and P2.0 at the same potential point? In this case, isn't the voltage difference across the resistor 0V? Isn't the circuit 0A? How come the light still turns on? How do you analyze it?" There are many problems with this circuit. Let's take a look at what the problems are.
This post is from Analog electronics

Latest reply

If the negative pole of the LED is connected to the IO port, this is possible, but if it is in normally open mode, the IO port will always be in current absorption mode, and the transistor of the IO port will always be in the on state.  Details Published on 2019-3-3 16:45

2921

Posts

0

Resources
2
 
There are many types of microcontroller output ports. If it is an OC output, then there is only one transistor to ground inside the output port. When the output is high, the internal transistor is open, and the power supply lights up the LED through the 470 ohm pull-up resistor. If it is a weak pull-up output, then the output port is a transistor and a pull-up resistor with a larger resistance. When the output is high, the transistor is open, and the internal pull-up resistor and the 470 ohm resistor are connected in parallel to power the LED. If it is a push-pull output, then the output port is controlled by a P-type transistor and an n-type transistor to control the pull-up and pull-down respectively. When the output is high, the pull-up transistor is turned on and the pull-down transistor is turned off. The pull-up transistor (in parallel with the 470 ohm) provides the LED current.
This post is from Analog electronics
 
 

32

Posts

0

Resources
3
 
This circuit is very bad. It is better to have a 1K resistor to isolate the IO output.
This post is from Analog electronics
 
 
 
 

693

Posts

7

Resources
4
 
Let's analyze it. If the microcontroller port outputs a low level and the forward resistance of the diode is very small, the voltage at the diode anode cannot open the voltage barrier of the diode, and the light will not light up; if the microcontroller port outputs a high level, the resistor is short-circuited, the diode anode voltage is higher than 0.7V, and the light will light up.
This post is from Analog electronics
 
 
 
 

693

Posts

7

Resources
5
 
This design is not common. Usually, the MCU port is connected to the cathode of the diode (LED) through a 10K voltage divider resistor. The IO port is off when it is high level, and it is lit when it is low level.
This post is from Analog electronics

Comments

The connection method you mentioned is more common. The characteristics of the microcontroller pins determine that this connection is better.  Details Published on 2019-2-27 14:41
 
 
 
 

5

Posts

1

Resources
6
 
I don't quite understand.
This post is from Analog electronics
 
 
 
 

5

Posts

1

Resources
7
 
Xinsheng Road Works
This post is from Analog electronics
 
 
 
 

1w

Posts

16

Resources
8
 
This LED is always bright no matter what the microcontroller does.
This post is from Analog electronics

Comments

When the output is low, the LED will not light up.  Details Published on 2019-2-27 14:42
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 
 

6366

Posts

4937

Resources
9
 
bqgup posted on 2019-2-27 13:52 This design is not common. Usually, the microcontroller port is connected to the cathode of the diode (LED) through a 10K voltage divider resistor. The high level of the IO port is extinguished, and the low...
The connection method you mentioned is more common. The characteristics of the microcontroller pins determine that this connection is better.
This post is from Analog electronics
 
 
 
 

6366

Posts

4937

Resources
10
 
ddllxxrr posted on 2019-2-27 14:39 This LED will light up no matter what the microcontroller does
When the output is low, the LED will not light up
This post is from Analog electronics

Comments

When the output is low, the LED will not light up. The microcontroller port is low, short-circuiting the LED, and of course the LED will not light up. However, the power consumption of the whole machine is greater than when the LED is on, so this control method is not advisable.  Details Published on 2019-3-1 15:06
When the output is low, the LED will not light up. The microcontroller port is low, short-circuiting the LED, and of course the LED will not light up. However, the power consumption of the whole machine is greater than when the LED is on, so this control method is not advisable.  Details Published on 2019-2-27 14:58
 
 
 
 

2w

Posts

0

Resources
11
 
tiankai001 posted on 2019-2-27 14:42 When the output is low, the LED will not light up
When the output is low, the LED will not light up. The microcontroller port is low, short-circuiting the LED, and of course the LED will not light up. However, the power consumption of the whole machine is greater than when the LED is on, so this control method is not advisable.
This post is from Analog electronics
 
 
 
 

1w

Posts

143

Resources
12
 
When P2.0 outputs a high level, aren't VCC and P2.0 equal to the same potential point? In this case, isn't the voltage difference across the resistor 0V? Isn't the circuit 0A? How can the light still be on? How do you analyze it? ——First, let me say something unpleasant but objective. This understanding is very mechanical, and you don't even understand the basic concept of the circuit. Assume that the internal resistance is 0 when P2.0 outputs a high level. Only in this way can the voltage difference across the resistor be 0, and the current flowing through the resistor is of course 0, but the current will flow through the LED through P2.0, and the LED will naturally light up. The current loop that can light up the LED is not the only one that passes through the 470 ohm resistor. However, in reality, the internal resistance of the MCU's IO cannot be 0, especially for weak pull-up IO, whose internal resistance is generally tens of kilo-ohms. Due to the current limiting of the resistor, the directly driven LED will either not light up or have a very low brightness, so the 470 ohm resistor is added to enhance the pull-up. When this circuit outputs a high level, most of the current supplied to the LED is provided by the 470 ohm resistor, and IO only provides a small current. The circuit is equivalent to a resistor of tens of kilo-ohms connected in parallel with the 470 ohm resistor and then connected in series with the LED. However, the design of this circuit is not advisable, because to turn off the LED, IO needs to absorb a large current, resulting in an unnecessary increase in power consumption. The circuit should be changed to connect the LED string with a current-limiting resistor and then to IO. When IO outputs 0, the LED is on, so there is no extra power consumption when the LED is off.
This post is from Analog electronics
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 
 

1w

Posts

143

Resources
13
 
By the way, being confused about this kind of problem is the result of not understanding the most basic concepts. In fact, using Ohm's law alone can perfectly understand and solve the problem. It is the way of thinking that determines whether it can be done, not the difficulty. I met an idiot named Ah Cai these two days. A very simple MOS tube switch circuit problem is essentially an Ohm's law problem of the relationship between resistance, current and voltage. As a result, he was unwilling to think about the basic concepts and even spoke ill of them. It's not the food that's scary, but the attitude that's scary. He is unwilling to understand the seemingly simplest basic concepts, and is always eager for success, which makes things slower and worse...
This post is from Analog electronics

Comments

That's the truth  Details Published on 2019-2-27 17:35
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 
 

6366

Posts

4937

Resources
14
 
chunyang posted on 2019-2-27 17:20 By the way, being confused about this kind of problem is the result of not understanding the most basic concepts. In fact, only using Ohm's law can perfectly understand and solve the problem...
This is the truth
This post is from Analog electronics
 
 
 
 

3980

Posts

0

Resources
15
 
The main building circuit is not completely useless. If the LED is always on when the equipment is normal and flashes when it is abnormal, it is desirable.
This post is from Analog electronics
 
Personal signature

YesWatt艺瓦特电子科技有限公司 傻大粗电源转换器制造商 https://apu5ob0ydv0ysskfm03hs4dtqfr97j68.taobao.com/

 
 
 

2865

Posts

4

Resources
16
 
This circuit should be the work of an engineer who was familiar with the 51 microcontroller in the early days. To illustrate the problem, I have provided the "open collector" circuit diagram [attach] 403631 [attach] This is the schematic diagram of the "weak pull-up" microcontroller output port. 1. When the LED is lit; it can be seen that when the port output is high, the port basically has no "load" capability. Therefore, the port does not consume much power when the LED is lit. The port voltage will also be pulled down by the 470R resistor. The current of the LED is basically obtained from the 470R resistor. 2. When the LED is off; the transistor is in the "on state" when the port outputs. The output is equivalent to grounding. At this time, the LED and the port transistor are connected to the ground in parallel. Therefore, most of the current is divided by the port transistor, and the LED will not light up. The current divided by the port will not exceed 7mA. Is 7mA a large current? It is more suitable for the situation where the light is always on and flashes when there is a fault.




新建位图图像 (2).bmp (312.67 KB, downloads: 0)

新建位图图像 (2).bmp
This post is from Analog electronics

Comments

Sometimes we will intentionally configure it as an open-drain output, which is almost the same as this weak pull-up, but the pin is usually used as the input of a low-end control circuit, and is controlled on and off by a MOS tube or a transistor at the negative pole of the load. In this post, the pin is used to short-circuit the load, which feels like using the short circuit as a switch.  Details Published on 2019-3-3 15:57
 
 
 
 

2865

Posts

4

Resources
17
 
Note: The circuit diagram above is a "schematic diagram", not the actual circuit schematic diagram of the integrated circuit. Please do not misunderstand. It is only to illustrate the characteristics of the early 51-port circuit.
This post is from Analog electronics

Comments

Thanks for sharing, very good  Details Published on 2019-3-1 08:49
 
 
 
 

869

Posts

0

Resources
18
 
Thanks for sharing. Like it.
This post is from Analog electronics
 
 
 
 

6366

Posts

4937

Resources
19
 
bigbat posted on 2019-2-28 19:52 To clarify: the circuit diagram above is a "schematic diagram", not the actual circuit schematic diagram of the integrated circuit, please do not misunderstand. Just to explain...
Thank you for sharing, very good
This post is from Analog electronics
 
 
 
 

127

Posts

0

Resources
20
 
tiankai001 posted on 2019-2-27 14:42 When the output is low, the LED will not light up
When the level is low, the anode voltage is not enough to light up the diode. When the level is high, the voltage across the resistor is the same, and no current will be generated, but the diode can light up. Because simply speaking, if you don't look at the resistor and only add 3.3V across the diode, the light will definitely light up. If the IO is floating, the diode should also be on.
This post is from Analog electronics
 
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list