(1) Used to provide driving capability for OC and OD gate circuits.
Take the OC (open collector) circuit as an example:
For example, the Darlington tube (actually a compound three-stage tube) integrated block ULN2003. The internal circuit is shown in the figure, which is an open collector circuit.
If you don't add a pull-up resistor, you can't drive other devices at a high level. Because when the transistor is cut off, there is no path for current to flow, let alone drive. This is the same principle as adding a pull-up resistor to the P0 port of the microcontroller.
(2) Increase the high level potential:
The MCU P1 port is connected to a 4×4 matrix keyboard. In addition, P1.0~P1.3 are reused to connect to an external ULN2003 to control the stepper motor.
Problems encountered in the experiment: The keyboard does not work when ULN2003 is connected, but it works normally after ULN2003 is removed. ULN2003 works normally. (Note: the two parts do not work at the same time)
Problem analysis: Due to the structure of the keyboard, it is nothing more than the connection or disconnection of two metal sheets. However, it cannot work properly after connecting to ULN2003, which means that the connection to ULN2003 affects the change of the level of P1 port. The voltage measured by the multimeter shows that when the microcontroller outputs a high level, the voltage of P1.0~P1.3 is about 1V, and the voltage of P1.4~P1.7 is about 4.3V. So the judgment potential of the high and low levels of AT89s52 is measured, which is about 1.3V. In this way, P1.0~P1.3 is always at a low level, and the keyboard cannot realize the scanning function at all.
The solution is to raise the potential of P1 port when it is at a high level, and it can work normally.
1. Connect a resistor in series from P1 to ULN2003 to divide the voltage and raise the voltage level.
2. Connect a pull-up resistor to the P1 port in parallel with the internal resistor of the P1 port to reduce the resistance of the pull-up resistor and the voltage divided, thereby raising the high-level potential of the P0 port.
The second solution can raise the voltage level to about 2.5V. The keyboard works normally.
In addition: When I was doing the LCD display experiment, the P0 port used for the data line could not work properly and no characters were displayed. However, the display phenomenon was not normal. The characters were not written at one time, but they had to be moved several times to write all the contents. Normally, all of them should be displayed at one time. The reason is that there are six ports in my P0 port, all of which are connected to three LEDs in parallel. Because I found out from the data that each port of the P0 port can absorb a maximum current of 10MA, and the total current cannot exceed 26MA. So my total current has reached 40MA, haha. Sorry for the joke. So I suspected that it was a driver problem. So I removed a few diodes. Everything was displayed normally. It seems that the problem has been solved, but I always feel that there is still a problem. So after several experiments, I found that only when one of the parallel diodes of the P0.7 port is removed and a light-emitting diode is connected to other ports. At this time, it can also display normally. But in this way, the P0 port absorbs 38MA, which is much more than 26MA. So it is not a problem of absorbing too much current. A careful analysis shows that when the port is connected in parallel with three external diodes, it is equivalent to adding a resistor of about 700 ohms. So the diode was removed and replaced with a 1k resistor, but the LCD still could not display.
After careful analysis, I think that since P0.7 is the return line of the LCD busy signal, when this port returns a high level, it means that the LCD is processing data and cannot receive new data. When it returns to 0, it means that it is idle and can receive new data.
In this way, when the pull-up resistor is too small, the LCD may return to a low level and the voltage may be higher than 1.3V (the judgment potential of the high and low levels of AT89s52). After receiving it, the microcontroller will not treat it as a low level, and of course it will not be displayed. (When the program is designed, the busy signal is detected and the detection continues)
Summary: There are also requirements for the selection of pull-up resistors, haha. It is neither the higher the better nor the lower the better. Choose according to your needs.
This may also be called impedance matching.
Previous article:51 MCU Summary--C Language Preprocessing
Next article:Circuit design of intelligent humidifier system based on single chip microcomputer
- Popular Resources
- Popular amplifiers
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Has anyone tried driving Zhengyuan Motor's coreless DC brushless motor (AM-BL2453A/B series) with STM32?
- Bluetooth product FCC certification, RF testing
- [Popular Science] Do you know how to match signal source impedance and set various parameters?
- News: Qorvo, a well-known RF chip company, also makes power solutions
- Why "It's time to abandon the switch matrix for multi-port testing" is all in Keysight's white paper ~ Limited time gifts are waiting for you
- It’s the beginning of autumn. Check out the beginning of autumn postcards from all over the country.
- How computer memory is organized
- Usage of SoftI2C and SoftSPI
- [Raspberry Pi 4B Review] + System Installation and Environment Construction
- 4G low-power LTE wireless communication module data sharing suitable for camera development