Home > Common Problem > There are several working modes of gpi and gpo of stm32 microcontroller.

There are several working modes of gpi and gpo of stm32 microcontroller.

青灯夜游
Release: 2020-09-10 10:56:42
Original
8133 people have browsed it

GPI has four working modes, namely: floating input, pull-up input, pull-down input, analog input; GPO has four working modes, namely: open-drain output, open-drain multiplexing function, Push-pull output, push-pull multiplexing function.

There are several working modes of gpi and gpo of stm32 microcontroller.

GPI has four working modes, namely: floating input, pull-up input, pull-down input, and analog input; GPO has four working modes, respectively They are: open-drain output, open-drain multiplexing function, push-pull output, push-pull multiplexing function.

There are several working modes of gpi and gpo of stm32 microcontroller.

Four working modes of GPI:

1. Floating input

Floating input is to directly enter the level signal of the I/O port into the input data register. In other words, the level status of the I/O is uncertain and is completely determined by the external input; if the pin is left floating (no signal input), reading the level of the port is uncertain.

The biggest feature of floating input is that the pin status read by the MCU completely follows the level change of the external IO port. It is generally used for key input, and the anti-interference performance is not as good as the pull-up and pull-down methods;

2. Pull-up input

The pull-up input directly enters the level signal of the I/O port into the input data register; but when the I/O port is left floating (no signal input ), the level of the input terminal can be maintained at a high level; and when the I/O port input is a low level, the level of the input terminal is still a low level.

The pull-up input has strong anti-interference ability and is especially suitable for the input of ground signals;

3. Pull-down input

The pull-down input is the I/O The level signal of the port directly enters the input data register. However, when the I/O port is floating (no signal input), the level of the input terminal can be maintained at a low level; and when the I/O port input is a high level, the level of the input terminal is still high. flat.

The pull-down input mode is opposite to the pull-up input mode. It is suitable for the effective signal to be connected to a high-level signal. The signal burrs are filtered through the voltage dividing resistor to improve the level stability.

4. Analog input

Analog input is to directly input the signal on the I/O port as an analog signal to the ADC inside STM32 for sampling conversion.

Four working modes of GPO:

1. Open drain output

Open drain The output is the value of the set/clear register or output data register through the setting bit, passes through the N-MOS tube, and is finally output to the I/O port.

The open-drain output terminal is equivalent to the collector of the transistor. To obtain a high-level state, a pull-up resistor is required. It is suitable for current-type driving. Its ability to absorb current is relatively strong. In addition, its ability to absorb current is relatively strong. The I/O port can also realize the function of a two-way communication port;

2. Open-drain multiplexing output

Open-drain multiplexing output mode, and open-drain output mode Very similar. It's just that the source of the high and low levels of the output is not determined by letting the CPU directly write to the output data register. Instead, it is determined by the multiplexed function output of the on-chip peripheral module.

3. Push-pull output

Push-pull output is to set/clear the register or output the value of the data register by setting the bit, passing through the P-MOS tube and N-MOS tube, and finally output to the I/O port.

Push-pull output mode, the I/O port can output high and low levels. Essentially, the internal push-pull structure is used, that is, the two transistors are controlled by two complementary signals respectively. At the same time, only one The triode is turned on and the other is turned off. The high and low level values ​​of the output are determined by the power supply of the IC circuit;

4. Push-pull multiplexing output

Push-pull multiplexing The output mode is very similar to the push-pull output mode. It's just that the source of the high and low levels of the output is not determined by letting the CPU directly write to the output data register. Instead, it is determined by the multiplexed function output of the on-chip peripheral module.

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of There are several working modes of gpi and gpo of stm32 microcontroller.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template