One article to understand the application principle of triode in circuit

The switching characteristics of transistors in digital circuits have two most common applications: one is for control applications, and the other is for driving applications. The so-called control is introduced as shown in Figure 3-7. We can control the base of the triode through the single-chip microcomputer to indirectly control the turning on and off of the small light behind. The usage is basically familiar to everyone. There is also a control to switch between different voltages. For example, our MCU is a 5V system. It is now connected to a 12V system. If the IO is directly connected to the 12V voltage, it will burn out the MCU, so we add a triode, The working voltage of the transistor is higher than the voltage of the IO port of the single chip microcomputer, and the IO port of 5V is used to control the 12V circuit, as shown in Figure 3-8.
Insert picture description here
In Figure 3-8, when the IO port outputs a high level of 5V, the transistor is turned on, OUT outputs a low level of 0V, when the IO port outputs a low level, the transistor is cut off, and OUT outputs 12V due to the pull-up resistor R2 High level, so that the working principle of low voltage control high voltage is realized.
The so-called drive mainly refers to the current output capability. Let's look at the comparison between the two circuits in Figure 3-9.
Insert picture description here
The LED light in the upper part of Figure 3-9 is the same as the LED light we talked about in the second lesson. When the IO port is high level, the small light is off, when the IO port is low level, the small light is on. Then the circuit below, according to this reasoning, when the IO port is high, there should be current flowing and lighting the small lamp, but in fact it is not so simple.
The single chip microcomputer is mainly a control device, which has the characteristics of four or two dials. Just as the lever must have a fulcrum, if you want to prop up the whole earth, you must have a fulcrum to bear the strength. The IO port of the single-chip microcomputer can output a high level, but its output current is very limited. When the ordinary IO port outputs a high level, it only has a current of tens to hundreds of uA, which is less than 1mA, so it is not enough. This LED light is on or the brightness is very low. At this time, if we want to light the LED with a high level, we can use a triode to handle it. The triode model on our board can pass 500mA of current, some The current through the transistor is still larger, as shown in Figure 3-10.
Insert picture description here
In Figure 3-10, when the IO port is high, the triode is turned on. Because the current of the triode is amplified, the current of the c-pole can reach more than mA, and the small LED can be successfully lit.
Although we use the low level of the IO port to directly light the LED, but the IO port of the single-chip microcomputer is used as a low level, can the input current be large? I think everyone can guess this, of course not. The current-carrying capacity of the IO port of the single-chip microcomputer is not the same for different models. For STC89C52, the official manual on page 81 introduces the electrical characteristics. The working current of the entire single-chip microcomputer should not exceed 50mA, and the total current of a single IO port should not exceed 6mA. Even though some of the enhanced 51's IO ports withstand a little more current, which can reach 25mA, it still has to be limited by the total current of 50mA. Then let's look at the part of the circuit of the 8 LED small lamps in the circuit diagram, as shown in Figure 3-11.
Insert picture description here
Here we have to learn a point of knowledge of the circuit diagram. All the wires on the right side of the LED on the right side of the circuit diagram are finally connected to a thick black line. Please note that this place is not actually completely connected together, but a This kind of bus drawing method, after drawing this line, indicates that this is a bus structure. All nodes with the same name are connected together in a one-to-one correspondence, and other nodes with different names are not connected together. For example, DB0 on ​​the left and DB0 under the LED2 on the right are connected together, but not connected with other lines such as DB1.
Then we take out the part that needs to be explained now in Figure 3-11 separately, as shown in Figure 3-12.
Insert picture description here
Now we calculate from the circuit diagram of 3-12, the voltage of 5V minus the voltage drop of the LED itself, subtracting the voltage drop between the transistors e and c, the current limiting resistance is 330 ohms, then each branch The current is about 8mA, then if all 8 LEDs are lit at the same time, the total current is 64mA. In this way, if directly connected to the IO port of the single-chip microcomputer, then the single-chip microcomputer can not bear it, even if it can be tolerated for a short time, long-term work will be unstable, and even cause the single-chip microcomputer to burn.

Some students will propose to increase the current limiting resistor to reduce this current. For example, if it is changed to 1K, the current is less than 3mA, and the total current of 8 channels is about 20mA. First of all, reducing the current will cause the brightness of the LED small lamp to be dimmed. The brightness of the small lamp may not matter much, but because we have connected the digital tube to the same circuit, we will talk about the dynamic display of the digital tube later. If the brightness of the digital tube is not enough If it is, the visual effect will be very poor, so the method of reducing the current is not preferable. Secondly, for the single-chip microcomputer, he mainly plays a controlling role, the current input and output capabilities are relatively weak, and the total current of the eight ports of P0 is also limited, so if you observe one or two LED lights, you can barely directly Use the IO port of the single-chip microcomputer to connect, but connect multiple small lights. From the perspective of actual engineering, it is not recommended to directly connect the IO port. So what should we do if we want to control multiple LED lights with a single-chip microcomputer?

In addition to transistors, there are actually some driver ICs. These driver ICs can be used as buffers for single-chip microcomputers, which are just current-driven buffers, and do not have any logical control effect. For example, the chip 74HC245 used on our board, this chip is in It doesn't play any other role logically. It is used as a current buffer. By checking its data sheet, 74HC245 works stably at 70mA. There is no problem, which is much larger than the 8 IO ports of the microcontroller, so we can use it Connect it between the small lamp and the IO port as a buffer, as shown in Figure 3-13.
Insert picture description here
Let's analyze from Figure 3-13, of which VCC and GND needless to say, careful students will find that there is a 0.1uF decoupling capacitor.

74HC245 is a bidirectional buffer. DIR 1 pin is the direction pin. When this pin is connected to high level, the voltage of all B numbers on the right side is equal to the voltage corresponding to the A number on the left side. For example, A1 is high level, then B1 is high level, A2 is low level, B2 is low level and so on. If the DIR pin is connected to a low level, the effect is that the voltage on the left A will be equal to the voltage on the right B. Because the control terminal of our place is connected to the P0 port on the left, we require the state that B is equal to A, so we directly connect the 5V power supply of pin 1, which is high level. In Figure 3-13, there is a row of resistors R10 to R17 which are pull-up resistors. The usage of this resistor will be introduced later.

There is also the last enable pin, pin 19, OE, called output enable. There is a horizontal line on this pin, indicating that it is low level effective. When the low level is connected, the 74HC245 will be bidirectional as described above. The role of the buffer, if OE is connected to a high level, no matter how DIR is connected, the pins of A and B are irrelevant, that is, the 74HC245 function cannot be realized.

As can be seen from Figure 3-14 below, the P0 port of the microcontroller and the A terminal of the 74HC245 are directly connected. At this place, some students have a question, that is, we obviously added a triode driver to the VCC power supply. Why do we need to add 245 driver chips? Here we all need to understand the truth that the circuit must pass through the device to the ground. First, there must be current to work properly. If any position in the circuit is disconnected, there will be no current, and the device will not participate in the work. Secondly, as with water flow, the thickness of the current water pipe from the positive pole to the negative pole of the power supply must meet the requirements. If the pipe is too thin at any position, there will be a bottleneck effect. The current will be limited and reduced in the thin pipe in the entire path. Every position of the circuit path must ensure that the channel is clear enough. The role of this 74HC245 is to eliminate the bottleneck of the single-chip IO link.
Figure 3-14 Connection between the single chip microcomputer and 74HC245

Published 97 original articles · 200 praises · 80,000+ views

Guess you like

Origin blog.csdn.net/weixin_44212493/article/details/104525688