The I/O port of the STC series microcontroller has a strong pull-up mode. What is the strong pull-up mode?
The I/O port of the STC microcontroller can be set to four modes: quasi-bidirectional port/weak pull-up, push-pull/strong pull-up, input/high impedance. When set to push-pull/strong pull-up, the current it can withstand is very large regardless of output 1 or 0.
The special function register (SFR) of the STC microcontroller adds PXM1 and PXM0 registers to the I/O port, and each port has such a pair. The working mode of the port can be selected by setting the value of PXM1:PXM0:
The definitions of PXM1 and PXM0 are as follows:
0 0 Quasi-bidirectional port (traditional IO)
0 1 Push-pull output (strong pull-up, current up to 20mA, use as little as possible)
1 0 Input only (high impedance)
1 1 Open drain, such as the traditional 8051 P0 port
The following takes the P1 port as an example:
The names of the mode configuration registers of the P1 port are P1M1 and P1M0, and the addresses are 91H and 92H respectively.
Example:
Whether it is assembly or C, the definition of registers is the same:
P1M1 equ 91H
P1M0 equ 92H
Then, there are the following statements in the program:
Assembly language:
mov p1m1,#00000000B
mov p1m0,#11111111B ; Set all p1 ports to strong pull-up mode
C language:
P1M0 = 0xC0;
P1M1 = 0xA0; //P1.7 open drain, P1.6 high impedance, P1.5 strong push-pull output, other quasi-bidirectional I/O ports.
Using this function, it is very easy to make the digital tube display brighter. In the past, I always thought about adding pull-up resistors or buying digital tubes with higher brightness. Now, I think it is great that I can do it with just a software setting. It is really cool!
(The microcontrollers I use are STC11F02E and STC12C5A60S2).
However, the teacher has two pieces of advice here:
1. Ants can drag things that are 100 times heavier than themselves, but they are still ants after all. It is obviously impossible to ask ants to pull a carriage. Therefore, the "strong" of strong pull is only relative. It is okay to pull a digital tube, but to pull devices such as relays, you still have to follow the standard circuit. You still have to add transistors when it is time. Don't be too greedy.
2. Once you set the I/O port to pull-up (push-pull) mode, you must not connect the wires of the two ports together, otherwise, once one pin outputs 1 and the other pin outputs 0, your port will be burned. If it is not set to pull-up mode, the I/O port will generally not be damaged.
Previous article:AT89s51-ADC0804 Experiment
Next article:Garbage weighing and charging control system based on single chip microcomputer AT89S51
Recommended ReadingLatest update time:2024-11-16 22:53
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- How to set the parameters of RC snubber circuit of mosfet switch tube in boost circuit
- Why is there a small series resistor on the digital signal line? (DC2222A LTC2500)
- Why is there a 50mV difference between the two input terminals of an op amp working in negative feedback?
- Award-winning live broadcast: Bluetooth 5.0, Thread, Zigbee, TI 15.4-Stack, multi-protocol management, all explained to you at once
- Programming implementation of volume control for media applications based on touchpad (Hot Wheels)
- Open Source ESP32 Color Screen WIFI/BLE Smart Multimeter Production Process (3. Frequency Duty Cycle Measurement)
- [Summary of power supply simulation data] 50+ power supply simulation analysis methods and simulation tool application resources
- mpu6050 six-axis sensor msp430 driver
- Talking about IoT and 5G
- [Distributed temperature and humidity acquisition system] + STM32H745I-LWIP debugging process