3492 views|13 replies

442

Posts

2

Resources
The OP
 

As shown in the figure, the voltage conversion is realized by controlling the transistor through an output pin of a 51 single-chip computer. How to calculate the values of R1 and R2 in the figure? [Copy link]

 
As shown in the figure, the voltage conversion is realized by controlling the transistor through an output pin of a 51 single-chip computer. How to calculate the values of R1 and R2 in the figure?
This post is from PCB Design

Latest reply

As can be seen from the first picture, if you want to input a high or low level from the OUT, that is, the microcontroller pin, the transistor must not be turned on (otherwise the input signal will be short-circuited to the ground). Therefore, before using it as an input, the microcontroller must write "1" to the I/O port, that is, the pin outputs a high level, that is, the transistor is turned off. At this time, the external signal can be applied to the OUT terminal. When the external signal is high, it is actually not necessary to provide current. The pull-up resistor R2 inside the chip can make the pin high (if the input signal is open, the microcontroller will think that the input is high). If the external signal is low, the input signal needs to "suck away" the current in R2 to the ground (when the microcontroller pin does not have an external pull-up resistor, it is tens of microamperes to 100 microamperes at most. When there is an external pull-up resistor, of course, the current in the external resistor must be added).   Details Published on 2020-9-22 16:40
 

1w

Posts

25

Resources
2
 

It should be calculated based on the transistor gain, output drive current, etc. Nowadays, the transistor gain can generally reach more than 100.

This post is from PCB Design
 
 

15

Posts

0

Resources
3
 
You can’t even do this, but you’re still studying quantum entanglement and antenna reception?
This post is from PCB Design
 
 
 

442

Posts

2

Resources
4
 
EEW2020 posted on 2020-1-29 12:38 You can't even do this, and you're still studying quantum entanglement and antenna reception?
Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer. There's nothing funny about knowing nothing about the internal structure of a single-chip microcomputer.
This post is from PCB Design
 
 
 

2w

Posts

0

Resources
5
 
EEW2018 posted on 2020-1-29 13:02 Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer. There is nothing funny about knowing nothing about the internal structure of a single-chip microcomputer.

In fact, you can answer this question by carefully reading the datasheet of the microcontroller. The datasheet of the microcontroller must have an explanation, including the "internal structure of the microcontroller".

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
6
 

The size of R2 needs to be determined based on the output current at the OUT terminal. The heavier the load (requiring a larger current at the OUT terminal), the smaller R2 should be. As for the calculation, of course, it is based on Ohm's law.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
7
 

R1 is determined based on the output current (collector current) required by the transistor and the transistor current amplification factor, with a certain margin left.

For example, if the transistor collector current is required to be 10mA and the current amplification factor is at least 50, then the base current must be at least 0.2mA. If the microcontroller outputs a high level close to 5V, then R1 should be less than 5/0.0002=25000 (ohms). In fact, R1 is usually 2 to 10 kilo-ohms.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
8
 

First post circuit, if the transistor is a little far from the microcontroller, the circuit should be connected in parallel with a resistor between the base and the ground, the resistance value is about 5 to 10 kilo-ohms. After adding this resistor, the transistor's anti-interference ability is much stronger than without this resistor.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
9
 

After connecting a resistor in parallel between the transistor base and ground, it is obvious that R1 should be smaller than the calculated value to ensure that the transistor can enter saturation when the microcontroller outputs a high level.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
10
 
This post was last edited by maychang on 2020-1-30 17:25
EEW2018 published on 2020-1-29 13:02 Everyone has learned digital circuits, but few have learned how to build a single-chip microcomputer. There is nothing funny about this question.

"Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer and know nothing about its internal structure."

In fact, the I/O port structure of the 51 single-chip microcomputer is the same as the picture in the first post, except that the power supply voltage is 5V.

R2 is the pull-up resistor inside the chip, the transistor is changed to a MOS tube (now all are CMOS technology), the IO marked in the figure is a latch, and the OUT end is the microcontroller pin.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
11
 
EEW2018 posted on 2020-1-29 13:02 Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer. There is nothing funny about knowing nothing about the internal structure of a single-chip microcomputer.

In the first figure, (under the control of the latch) the transistor is saturated and turned on, and the pin OUT outputs a low level. (Under the control of the latch) the transistor is turned off, and the pin OUT outputs a high level.

It can be seen that the pin outputs a high level completely by pulling it up with the resistor R2 in the first figure. The low level is achieved by the saturation conduction of the transistor.

Because a larger current is allowed to flow through the transistor when it is saturated and turned on, and the resistor R2 has a larger value, the pull-down capability of the 51 series microcontroller pin is much stronger than the pull-up capability.

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
12
 
EEW2018 posted on 2020-1-29 13:02 Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer. There is nothing funny about knowing nothing about the internal structure of a single-chip microcomputer.

As can be seen from the first picture, if you want to input a high or low level from the OUT, that is, the microcontroller pin, the transistor must not be turned on (otherwise the input signal will be short-circuited to the ground). Therefore, before using it as an input, the microcontroller must write "1" to the I/O port, that is, the pin outputs a high level, that is, the transistor is turned off. At this time, the external signal can be applied to the OUT terminal. When the external signal is high, it is actually not necessary to provide current. The pull-up resistor R2 inside the chip can make the pin high (if the input signal is open, the microcontroller will think that the input is high). If the external signal is low, the input signal needs to "suck away" the current in R2 to the ground (when the microcontroller pin does not have an external pull-up resistor, it is tens of microamperes to 100 microamperes at most. When there is an external pull-up resistor, of course, the current in the external resistor must be added).

This post is from PCB Design
 
 
 

2w

Posts

0

Resources
13
 
EEW2018 posted on 2020-1-29 13:02 Everyone has learned digital and analog circuits, but few have learned how to build a single-chip microcomputer. There is nothing funny about knowing nothing about the internal structure of a single-chip microcomputer.

The previous replies from the 6th to the 12th floor should note that this is only limited to the "quasi-bidirectional port" of the 51 microcontroller, and may not be applicable to other types of microcontrollers. Many microcontrollers have a push-pull structure for their I/O ports, which is different from the structure of the 51 series microcontrollers.

This post is from PCB Design
 
 
 

1643

Posts

0

Resources
14
 

As can be seen from the first picture, if you want to input a high or low level from the OUT, that is, the microcontroller pin, the transistor must not be turned on (otherwise the input signal will be short-circuited to the ground). Therefore, before using it as an input, the microcontroller must write "1" to the I/O port, that is, the pin outputs a high level, that is, the transistor is turned off. At this time, the external signal can be applied to the OUT terminal. When the external signal is high, it is actually not necessary to provide current. The pull-up resistor R2 inside the chip can make the pin high (if the input signal is open, the microcontroller will think that the input is high). If the external signal is low, the input signal needs to "suck away" the current in R2 to the ground (when the microcontroller pin does not have an external pull-up resistor, it is tens of microamperes to 100 microamperes at most. When there is an external pull-up resistor, of course, the current in the external resistor must be added).

This post is from PCB Design
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

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