When the P0 port is used as an I/O port output, the output low level is 0 and the output high level is a high configuration (not 5V, equivalent to a floating state, that is, the P0 port cannot really output a high level). To provide current to the connected load, a pull-up resistor must be connected (a resistor connected to VCC), and the power supply provides current to the load through this pull-up resistor. When P0 is used as an input, a pull-up resistor is not required, but it must be set to 1 first. Because the pull-up field effect transistor is always cut off when the P0 port is used as a general I/O port, if it is not set to 1, the pull-down field effect transistor will be turned on, and only 0 can be read forever. Therefore, set 1 before the input to cut off the pull-down field effect transistor, and the port will be in a high-impedance floating state, so that data can be read correctly.
Since there is no pull-up resistor inside the P0 port and it is open drain, no matter how strong its driving capability is, it is equivalent to having no power and requires an external circuit to provide it. In most cases, a pull-up resistor must be added to the P0 port.
1. Generally, the P0 port of a 51 single-chip microcomputer is not connected to a pull-up resistor when used as address/data multiplexing.
2. When used as a general I/O port, since there is no internal pull-up resistor, a pull-up resistor must be connected!!
3. When the p0 port is used to drive the PNP tube, there is no need for a pull-up resistor because the low level is valid at this time;
4. When the P0 port is used to drive the NPN tube, a pull-up resistor is required, because only when P0 is 1 can the back-end be turned on. To put it simply, it must have a power supply to drive the LCD display, otherwise it will not light up. It happens that the P0 port has no power supply, so an external power supply is required, and the resistor is connected to play the role of current limiting; if it is connected to the P1, P2, and P3 ports, no external power supply and resistor are required.
The P0 port is open drain. No matter how strong its driving capability is, it is equivalent to having no power supply and requires an external circuit to provide it. In most cases, a pull-up resistor must be added to the P0 port. When the P0 port of the 5.51 microcontroller is used as a data and address bus, a pull-up resistor is not required.
The driving capability of some ICs is not strong. If the P0 port is used as an input and an unnecessary pull-up is added, it is possible that the driver IC cannot pull it back to a low level, causing the input to fail!
If it is to drive LED, then use about 1K. If you want a brighter brightness, the resistance can be reduced, and the minimum should not be less than 200 ohms, otherwise the current will be too large; if you want a smaller brightness, the resistance can be increased. How much to increase depends mainly on the brightness. The brightness is appropriate. Generally speaking, when it exceeds 3K, the brightness is very weak, but for ultra-high brightness LEDs, sometimes the brightness is still acceptable when the resistance is 10K. Usually 1k is used. For driving optical couplers, if the high potential is effective, that is, between the coupler input terminal port and ground, then it is the same as the situation of LED; if the low potential is effective, that is, between the coupler input terminal port and VCC, then in addition to connecting a resistor between 1 and 4.7k in series, the resistance value of the pull-up resistor can be particularly large, between 100k and 500K, of course, 10K is also OK, but considering the power saving problem, it is not necessary to use such a small one.
For the driving transistor, it is divided into two cases: PNP and NPN tubes: For NPN, there is no doubt that the NPN tube is high-level effective, so the resistance of the pull-up resistor can be between 2K and 20K, and the specific size depends on what load the collector of the transistor is connected to. For LED loads, since the light-emitting current is very small, the resistance of the pull-up resistor can be 20k, but when the collector of the tube is a relay load, due to the large collector current, the resistance of the pull-up resistor should not be greater than 4.7K, and sometimes even 2K is used. For PNP tubes, there is no doubt that the PNP tube is low-level effective, so the resistance of the pull-up resistor can be more than 100K, and the base of the tube must be connected in series with a 1-10K resistor. The size of the resistance depends on what the load of the collector of the tube is. For LED loads, since the light-emitting current is very small, the resistance of the resistor connected in series with the base can be 20k, but when the collector of the tube is a relay load, due to the large collector current, the resistance of the base resistor should not be greater than 4.7K.
For driving TTL integrated circuits, the pull-up resistor should be between 1 and 10K. Sometimes, if the resistor is too large, it cannot be pulled up, so a smaller resistance is used. However, for CMOS integrated circuits, the pull-up resistor can be very large, generally not less than 20K. I usually use 100K. In fact, for CMOS circuits, the pull-up resistor can be 1M, but it should be noted that when the pull-up resistor is too large, interference is likely to occur, especially when the lines on the circuit board are very long, this interference is more serious. In this case, the pull-up resistor should not be too large, generally less than 100K, and sometimes even less than 10K.
According to the above analysis, there are many considerations when selecting the resistance value of the pull-up resistor and it cannot be used indiscriminately.
Previous article:Keil C51 accurate delay program design
Next article:MCU Basics: Programming Keyboard/Display Interface - INTEL 8279
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- [National Technology N32G457 Review] ML component control
- [N32L43X Review] 4.Timer&MultiTimer Hardware Timer and Software Timer
- MSP430F5438A and LIS3DSH
- Playing with Zynq Serial 47——[ex66] Image Histogram Equalization Processing of MT9V034 Camera
- Anlu SparkRoad Development Board Review (6) Use of FIFO IP
- Features and differences of ARM, DSP and FPGA
- [GD32L233C-START Review] 14. RT-Thread kernel and finsh ported to GD32L233
- Introduction to the classification and development history of carrier aggregation
- Share the written test questions for embedded software engineers
- csmc0.5um process library