The function and application principle of the pull-up resistor
1. Definition
1. The pull-up is to clamp the uncertain signal at a high level through a resistor! "The resistor also functions as a current limiter"! The same is true for the pull-down!
2. The pull-up is to inject current into the device, and the pull-down is the output current
3. Weak and strong are just different in the resistance of the pull-up resistor, there is no strict distinction
4. For non-collector (or drain) open-circuit output circuits (such as ordinary gate circuits), the ability to increase current and voltage is limited. The function of the pull-up resistor is mainly to output current channels for open-collector output circuits.
2. The function of pull-up resistor
1. Generally, when used as a single-key trigger, if the IC itself does not have an internal resistance, in order to maintain the single-key in the non-triggered state or return to the original state after triggering, another resistor must be connected outside the IC.
2. The digital circuit has three states: high-level, low-level, and high-impedance state. In some applications, high-impedance state is undesirable. It can be in a stable state through pull-up resistors or pull-down resistors, depending on the design requirements. It depends!
4. The pull-up resistor is used to provide current when the bus driving capability is insufficient. Generally speaking, it is to source current, and the pull-down resistor is used to absorb current, which is what we usually call sink current
5. The resistance is connected to prevent the input terminal from floating
6. Reduce the interference of external current on the chip
7. Protect the protective diode in cmos, the general current is not more than 10mA
8. Increase or decrease the drive current through pull-up or pull-down
9. Change the level of potential, commonly used in TTL-CMOS matching
10. There is a certain state when the pin is floating
11. Increase the drive capability at high level output.
12. Provide current for OC gate
Three, pull-up resistor application principles
1. When the TTL circuit drives the CMOS circuit, if the high level of the TTL circuit output is lower than the high level of the CMOS circuit (usually 3.5V), then it is necessary to connect a pull-up resistor to the TTL output terminal to improve Output high level value.
2. The OC gate circuit "must be used with a pull-up resistor".
3. To increase the drive capability of the output pins, pull-up resistors are often used on some single-chip pins.
4. On the COMS chip, in order to prevent damage caused by static electricity, unused pins cannot be left floating. Generally, a pull-up resistor is connected to reduce the input impedance and provide a leakage path.
5. Add pull-up resistors to the pins of the chip to increase the output level, thereby improving the noise tolerance of the chip's input signal and enhancing the anti-interference ability.
6. Improve the anti-electromagnetic interference capability of the bus. If the pin is left floating, it is easier to accept external electromagnetic interference.
7. The resistance mismatch in long-term transmission can easily cause reflected wave interference, and the pull-down resistor is resistance matching, which effectively suppresses reflected wave interference.
8. The input pins that are not used in the digital circuit must be connected to a fixed level, connected to a high level or grounded through a 1k resistor.
Fourth, the selection principle of pull-up resistor resistance
1. It should be large enough to save power consumption and the current sink capability of the chip; the resistance is large and the current is small.
2. It should be small enough to ensure sufficient drive current; the resistance is small and the current is large.
3. For high-speed circuits, excessive pull-up resistors may have smooth edges. Considering
The above three points are usually selected between 1k and 10k. The same applies to pull-down resistors.
The selection of pull-up resistance and pull-down resistance should be set in combination with the characteristics of the switch tube and the input characteristics of the lower-level circuit, and the following factors need to be considered:
1. The balance of drive capability and power consumption. Take the pull-up resistor as an example. Generally speaking, the smaller the pull-up resistor, the stronger the drive capability, but the greater the power consumption. The design should pay attention to the balance between the two.
2. The driving requirements of the lower-level circuit. Take the same pull-up resistor as an example. When the output is high, the switch tube is disconnected. The pull-up resistor should be selected appropriately to provide sufficient current to the downstream circuit.
3. Setting of high and low level. The threshold level of the high and low level of different circuits will be different, and the resistance should be set appropriately to ensure that the correct level can be output. Take the pull-up resistor as an example. When the output is low, the switch is turned on, and the pull-up resistor and the on-resistance of the switch should be under the zero-level threshold.
4. Frequency characteristics. Take the pull-up resistor as an example. The capacitance between the pull-up resistor and the drain-source stage of the switch tube and the input capacitance between the lower-level circuit will form an "RC delay". The larger the resistance, the greater the delay. The setting of the pull-up resistor should consider the demand of the circuit in this respect.
The principle of setting the pull-down resistor is the same as that of the pull-up resistor.
When the OC gate outputs a high level, it is in a high-impedance state, and its pull-up current should be provided by a pull-up resistor. Set the input port to no more than 100uA, and set the output port drive current to about 500uA. The standard operating voltage is 5V. The high and low level threshold is 0.8V (lower than this value); 2V (high level threshold).
When the pull-up resistor is selected: 500uA x 8.4K= 4.2 that is, when it is greater than 8.4K, the output terminal can be pulled down below 0.8V. This is the resistance value, and it cannot be pulled down even if it is smaller. If the output port drive current is large, the resistance can be reduced to ensure that it can be lower than 0.8V when pulled down. When the output is high, ignore the leakage current of the tube. The two input ports need 200uA, 200uA x15K=3V, that is, the pull-up resistor voltage drop is 3V, and the output port can reach 2V. This resistance is the resistance value, and it cannot be pulled if it is larger 2V up. 10K is available. 【Voltage drop/current, pressure drop/current】
COMS gate can refer to the 74HC series design. The leakage current of the tube cannot be ignored. The actual current of the IO port is also different under different levels. The above is just the principle. One sentence can be summarized as: "When the output is high, the following input should be fed. Do not feed the output port when the output is low. Otherwise, the excess current will be fed to the input port of the cascade, and it will be unreliable if it is higher than the low level threshold.
In addition, the following points should be noted:
A. It depends on what device the output port drives. If the device requires a high voltage and the output voltage of the output port is not enough, a pull-up resistor needs to be added.
B. If there is a pull-up resistor, its port is at high level by default. You must use low level to control it to control the collector of a tri-state gate circuit transistor or the anode of a diode to control the pull-up resistor The current is pulled down to a low level.
C. Especially used in interface circuits. In order to obtain a certain level, this method is generally used to ensure the correct circuit state to avoid accidents. For example, in motor control, the upper and lower arms of the inverter bridge cannot be connected directly. They are all driven by the same single-chip microcomputer, and the initial state must be set to prevent straight-through!
Drive the sink current as much as possible.
When selecting the resistor, choose the one that is close to the standard value after calculation!
The reasons why P0 needs a pull-up resistor are:
1. There is no pull-up resistor in P0 port
2. When P0 is the working state of the I/O port, the upper FET is turned off and the output pin is floating. Therefore, when P0 is used as an output line, it is an open-drain output.
3. Since there is no pull-up resistor on the chip, the upper FET is turned off again, and the port level cannot be pulled up when P0 outputs 1.
P0 is a bidirectional port, the others P1, P2, and P3 are quasi bidirectional ports. The quasi-bidirectional interface is because you need to "prepare" when reading external data. Why do you need to prepare?
When the microcontroller reads the port of the quasi-bidirectional port, the port latch should be set to 1 first, the purpose is to turn off the FET, so that the port will not be clamped at low level due to the on-chip FET conduction.