Current injection method: the positive pole of the LED is connected to VCC, and the negative pole is connected to the IO port. When IO is high level, the two poles of the LED are at the same level, there is no current, and the LED is off; when IO is low level, the current flows from VCC to IO, and the LED lights up. However, when you connect the positive pole of the LED to the IO interface and the negative pole to GND, and set the IO interface to a high level, the LED will light up, but the brightness is not ideal because the IO interface has insufficient pull-up capability. You can use the following method to solve this problem.
Push-pull working mode: The positive and negative poles of the LED are connected to two IO ports respectively, and then the positive IO interface is set to push-pull output, and the negative IO interface is set to standard bidirectional current sink input. The push-pull mode has strong pull-up capability and can achieve high-level driving of LEDs.
Four ways to use IO ports
From the characteristics of the I/O port, the P0 port of the standard 51 is an open-drain structure when used as an I/O port, and a pull-up resistor is usually added in actual applications; P1, P2, and P3 are all quasi-bidirectional I/O ports with internal pull-up resistors, which can be used as both input and output. The I/O port characteristics of the LPC900 series microcontrollers are somewhat different, and they can be configured into 4 different working modes: quasi-bidirectional I/O, push-pull output, high-impedance input, and open-drain.
Compared with the standard 51, the quasi-bidirectional I/O mode is different in internal structure, but similar in usage. For example, when it is used as an input, you must first write "1" to set it to a high level, and then you can read the level status of the pin. ! ! ! ! ! Why is it like this? See the following graphic analysis.
The characteristic of push-pull output is that it can drive a large current regardless of whether the output is high or low. For example, when the output is high, the LED can be directly lit (with a current-limiting resistor of several hundred ohms connected in series), which is difficult to do in quasi-bidirectional I/O mode.
The characteristic of high-impedance input mode is that it can only be used as an input, but a relatively high input impedance can be obtained, which is necessary in analog comparator and ADC applications.
The open-drain mode is similar to the quasi-bidirectional mode, but there is no internal pull-up resistor. The advantage of the open-drain mode is good electrical compatibility. If the external pull-up resistor is connected to a 3V power supply, it can interface with a 3V logic device. If the pull-up resistor is connected to a 5V power supply, it can interface with a 5V logic device. In addition, the open-drain mode can also easily implement the "wired AND" logic function.
To explain the above question, there is such a document:
High impedance state is a common term in digital circuits, which refers to an output state of the circuit, which is neither a high level nor a low level. If the high impedance state is input into the next level circuit, it will have no effect on the next level circuit, just like not connected. If measured with a multimeter, it may be a high level or a low level, depending on what is connected to it.
When analyzing a circuit, the high impedance state can be understood as an open circuit. You can think of it as the output (input) resistance being very large. Its limit can be considered as floating.
Typical applications of high impedance state:
1. In the structure of bus connection. There are multiple devices on the bus, and the devices are connected to the bus in the form of high impedance. In this way, the bus is automatically released when the device does not occupy the bus, so that other devices can obtain the right to use the bus.
2. Most microcontroller I/Os can be set to high-impedance input when used, such as Lingyang, AVR, etc. High-impedance input can be considered as an infinite input resistance, and it is considered that the I/O has little effect on the previous stage, and does not generate current (no attenuation), and to a certain extent, it also increases the chip's ability to resist voltage shocks.
Previous article:Introduction to the control pins of 51 single-chip microcomputer
Next article:51 single chip microcomputer uses digital tube to display dynamic detection results
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----Infinite sensor network and radio frequency identification technology RFID
- EEWORLD University Hall----Live Replay: Applications and Techniques of Keysight Oscilloscopes in General Electronic Measurements
- What would you think if the Internet of Things and AI were added to the electronic design competition?
- Problems with building long-distance networks with low-power nodes
- Initial hardware design, need some information about OMAPL138
- Can this diagram be used in this way?
- Calling the Viterbi kernel
- Request RF amplifier design solution
- IAR creates a new MSP430 project
- About LDO voltage regulator chip