The main content introduces the detailed usage of AVR microcontroller IO
The relationship between the AVR microcontroller register DDRx PORTx PINx and the corresponding IO port (x represents a port, such as port A, port B, etc.)
The following table uses the second bit PB2 of port B as an example and assumes that PB2 is floating.
DDRB.2 | PORTB.2 | Read the result of PINB.2 | Status of pin PB2 |
1 | 1 | 1 | PB2 push-pull output 1 |
1 | 0 | 0 | PB2 push-pull output 0 |
0 | 1 | 1 | PB2 weak pull-up, can be used as input |
0 | 0 | × | PB2 high impedance, can be used as input |
When reading PINB.2, the actual level of the PB2 pin is read.
If PB2 is directly connected to VCC, then the result of reading PINB.2 at any time is 1
If PB2 is directly connected to GND, then the result of reading PINB.2 at any time is 0
Previous article:Detailed information on the internal structure of the AVR microcontroller's CPU
Next article:AVR MCU Selection Guide
Recommended ReadingLatest update time:2024-11-16 21:29
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
- AD621 and AD620
- Introduction to the conventional methods and shortcut keys for drawing schematics in KiCad
- When a differential op amp is used as a voltage detector for a battery in a battery pack, what is the output voltage expression? Virtual short: V+=v- ...
- 520 is coming soon, the science and engineering man prepared a hardcore gift for his wife
- Automatic License Plate Recognition System Based on ARM Cortex
- come on
- MM32F103 Development Board Evaluation: User Experience Suggestions
- Why is Ie in this common emitter circuit negative?
- From distributor to service provider, how Avnet deploys the Internet of Things
- [Fudan Micro FM33LC046N] Similar timer module