Detailed explanation of MCU quasi-bidirectional port IO

Publisher:温馨时光Latest update time:2016-09-07 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Several IO port configurations of single chip microcomputer

 

In the study, development and application of microcontrollers, the configuration of IO ports plays an important role in the realization of functions. The following introduces four common configurations. Now many microcontrollers have all four configurations to choose from.

 

1. Quasi-bidirectional port configuration

 

As shown in the figure below, when the IO output is high, its driving ability is very weak, and the external load can easily pull it to a low level. When the IO output is low, its driving ability is very strong and can absorb considerable current.

 

The quasi-bidirectional port has three pull-up transistors, one "very weak pull-up" that is turned on when the port latch is logic "1", and when the port is floating, the "very weak pull-up" pulls the port up to a high level.

 

The second pull-up transistor is a "weak pull-up" and is turned on when the port latch is logic "1" and the port itself is also "1". The current provided by this pull-up makes the quasi-bidirectional port output "1". If the port is
pulled to logic "0" by an external device at this time, the "weak pull-up" is controlled to be closed through the Schmitt trigger, while the "very weak pull-up" remains open. In order to pull this port low, the external device must have sufficient current sinking capability to
reduce the voltage on the pin below the threshold voltage.

 

The third pull-up transistor is a "strong pull-up". When the port latch jumps from "0" to "1", this pull-up is used to speed up the port's transition from logic "0" to logic "1".

 

When the quasi-bidirectional port is used as input, a Schmitt contactor and a NOT gate are used for interference and filtering.

 

IO port settings: quasi-bidirectional port detailed explanation - fandy - fandys notes

 

 

 

When the quasi-bidirectional port is used as input, the button can be connected to the ground, as shown in Figure 1. Of course, R1 can also be removed and the button can be connected directly. When the button is closed, the port is pulled to a low level. When the button is released, the port is
pulled to a high level by the internal "very weak pull-up" transistor. When the port is used as an output, it should not be connected to the ground for external LEDs such as graphic control. In this way, the driving ability of the port is very weak, and the LED can only emit very weak light. If you want to drive the LED, you should use
the method in Figure 3. In this way, the quasi-bidirectional port can absorb 20mA of current when the output is low, so it can drive the LED. The method in Figure 4 is also acceptable, but when the LED is not emitting light, the port needs to absorb a large current.

 

IO port settings: quasi-bidirectional port detailed explanation - fandy - fandys notes

 

 

 

2. Open-drain output configuration

 

This configuration turns off all pull-up transistors and only drives the pull-down transistors. The pull-down is the same as the quasi-bidirectional port pull-down configuration, so it can only output low level (absorb current) and high impedance state. It cannot output high level (output current). If it is to be used as a logic output, a pull-up resistor must be connected to VCC. This configuration can also be used to drive LEDs through Figures 3 and 4 above.

 

IO port settings: quasi-bidirectional port detailed explanation - fandy - fandys notes

 

 

 

3. Push-pull output configuration

 

The pull-down of this configuration is the same as the quasi-bidirectional port and open-drain configuration, and has a strong current-sourcing capability. The difference is that it has a continuous strong pull-up. Therefore, the method in Figure 2 above can be used to drive the LED.

 

 

 

IO port settings: quasi-bidirectional port detailed explanation - fandy - fandys notes

 

4. Input configuration only (high impedance configuration)

 

This configuration cannot output current or receive current and can only be used as input data.

 

IO port settings: quasi-bidirectional port detailed explanation - fandy - fandys notes

 

 

 

The above four configurations each have their own characteristics and should be used flexibly according to their characteristics during use.

 

The biggest feature of the quasi-bidirectional port is that it can be used as both input and output without the need for control switching.

 

The characteristic of push-pull output is that it has a large driving ability regardless of the input high level or low level. When the input is high level, it can also directly light up the LED, which is not possible in the quasi-bidirectional port. This configuration is not suitable as an input because it requires the external device to have a strong current-drawing ability.

 

The characteristic of input-only configuration is that the port can only be used as input and can obtain very high input impedance. It is often used in ports with analog comparators or ADCs.

 

The open-drain output configuration is similar to the quasi-inverter output, but there is no internal pull-up resistor. It has good electrical compatibility. If you connect an external pull-up resistor to a 3V power supply, you can connect to a 3V logic device. If you connect an external pull-up resistor to a 5V power supply, you can connect to a 5V device.

 

It should be noted that the above four configurations can all be used as inputs, that is, they can all detect the logical state of the end, but their characteristics are different, and not every configuration can be directly connected to a button.

Keywords:MCU Reference address:Detailed explanation of MCU quasi-bidirectional port IO

Previous article:Implementation of a power management driver design based on SEP0611
Next article:Single chip microcomputer controlled relay closing circuit diagram

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号