In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the special usage of IO in the STC single-chip microcomputer, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
What is the special use of IO we are talking about today? To put it simply, because there are many IO of STC single-chip microcomputer with reuse function, after the single-chip microcomputer is powered on and reset, the default state of these reuse function pins has some special regulations or treatment methods, if you do not know, it is likely to have catastrophic problems, let's talk about the usage of these special IO in detail below.
Under normal circumstances, after the 51 single-chip microcomputer is powered on and reset, all IO ports are high by default and work in quasi-bi-directional IO mode, but four working modes of IO have appeared in the MCU after STC15 series, and an IO with multiplexing function will not be quasi-bi-directional IO mode after power-on reset. We need to take care of these pins when we use them.
1. PWM-related pins
In the STC15 series single-chip microcomputer, the 12 IO related to PWM2 to PWM7 defaults to high resistance input mode after power-on reset. When the output is needed, the user needs to set it to push-pull output or quasi-bi-directional IO mode through the program.
In STC8 series single-chip microcomputer, all IO related to PWM are in quasi-bi-directional IO mode after reset. Users can choose to set it to open-leak output mode when burning (downloading) programs through ISP software, and they can also set it to the desired working mode by means of programs.
2. Low voltage reset pin P2.0
In the STC15 series microcontroller, the low voltage reset pin RSTOUT_LOW pin is mostly in the P2.0 pin, a few types of single chip microcomputer this pin in the P1.0 and P3.3 pin. After the pin is powered on and reset, the user can choose whether it is high level or low level when ISP is burning (downloading) the program. When the power supply voltage of the single-chip microcomputer is lower than the threshold voltage (3V single-chip microcomputer is about 1.8V, 5V single-chip microcomputer is about 3.2V), the RSTOUT_LOW pin will output the low level; when the power supply voltage of the single-chip microcomputer is higher than the threshold voltage, the RSTOUT_LOW pin will output the level set by the user when the ISP burning (downloading) program.
In the STC8 series MCU, the low voltage reset pin RSTCV pin is in the P2.0 pin, and the initial level of power-on reset can be set by the user when ISP is burning (downloading) the program. When the power supply voltage of the single-chip microcomputer is lower than 1.6V, the single-chip microcomputer will output a high level on the P2.0/RSTCV pin. Only when the power supply voltage of the single-chip microcomputer rises to more than 1.6V will the single-chip microcomputer output the level state set by the user in the ISP burning (downloading) program on the P2.0/RSTCV pin.
3. Reset pin RST
In the STC15 series single-chip microcomputer, the specific type of reset pin RST pin is not the same. In the STC15 series single-chip microcomputer, the reset pin can be used as an ordinary IO port. The user can set the reset pin RST function when the ISP burning (downloading) program. When the user sets the reset pin to the ordinary IO port, the reset pin will be set to quasi-bi-directional IO mode after power-on. At the moment of each power-up, the single-chip microcomputer will identify the user's setting of the ISP pin when the last RST burning (downloading) program is downloaded, and then set the RST reset pin according to the user's settings.
4. XTAL1 and XTAL2 pins
In STC15 series MCU, XTAL1 and XTAL2 pins are P1.7 and P16 pins by default. These two pins are not necessarily quasi-bi-directional IO mode after power-on reset, but high resistance input mode when they are used as clock input or crystal oscillator connection pins. The details can be determined by whether the user chooses the internal IRC clock when ISP is burning (downloading) the program. The single-chip microcomputer will set the two pins to high resistance input mode at the moment of power up, and then judge whether the internal IRC clock was selected the last time the user carried out the ISP burning (download) program. If the user chooses the internal IRC clock, then the single-chip microcomputer will set the IO to quasi-bidirectional IO mode. If the user does not choose to use the internal clock. Then the single-chip microcomputer will maintain the high resistance input mode that was originally set at the beginning.
Note: the selection error here will lead to the situation that the program cannot be downloaded, for example, the user chooses not to use the internal IRC clock, but there is no crystal oscillator or clock source on the external clock pins of the single-chip microcomputer, so it will not be able to download.
Because the STC8 single-chip microcomputer does not need external reset and external crystal oscillator, so the reset pin and clock pin will not appear special circumstances for the STC8 series single-chip microcomputer. In fact, the STC8 series single-chip microcomputer does not have a special external reset pin, but it has an external clock pin. STC8 has three clock source selections, with clock source selection registers, clock control registers and other clock-related registers to select and control, so there will be no special circumstances on the clock pins, so we do not explain here.
The above is how the special usage of IO in the STC single chip microcomputer is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.