When does the 51 MCU P0 port use a pull-up resistor?

Publisher:iota19Latest update time:2013-05-18 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:When does the 51 MCU P0 port use a pull-up resistor?

Previous article:Keil C51 accurate delay program design
Next article:MCU Basics: Programming Keyboard/Display Interface - INTEL 8279

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号