How should we understand the peripherals of 51 microcontroller? Do the following experiment.
Experiment 1: Experiment with external interrupt 0
Experimental steps: Connect one end of a DuPont cable to the P3^2 port, and the other end to the power supply or ground.
Experimental procedure:
#include
sbit led = P1^0;
void mian(void)
{ while(1){
if(IE0){
led = 0;
}
else{
led = 1;
}
}
}
Experimental results: When the other end of the DuPont line is connected to power, the LED goes out; when it is connected to ground, the LED lights up.
Conclusion: Regardless of whether it is configured or not, the external interrupt peripheral of the 51 microcontroller is working and cannot be disabled.
Experiment 2: Experiment with timer 0
Experimental procedure:
#include
sbit led = P1^0;
void main(void)
{
TR0 =1;
while(1){
if(TF0 == 1){
led = 0;
}
}
}
Experimental results: It was observed that the LED was lit
Conclusion: The 51 microcontroller CPU controls timer/counter 0 by TR0. When TR0 is 1, it works; when it is 0, it stops.
When overflow occurs, TF0 is set to 1; otherwise, it is set to 0.
A peripheral is a device other than the CPU that helps the CPU fully realize its functions.
Previous article:Intelligent temperature control fan design based on 51 microcontroller
Next article:51 Single-chip multi-machine communication principle
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
- What are the advantages of electronic load switches over MOS or transistors as output control? Now many domestic semiconductor...
- Lighter igniter electric shock/ignition principle
- This is the second time I haven't seen any replies in the past few days. The pattern is: there are replies on the 20th floor, but no more on the 21st floor; there are replies on the 40th floor, but no more on the 41st floor...
- Find TI, NXP, ALTERA, XILINX, ST, Microchip factory stock chips
- Record the use of TM1668 driver
- Newbie help, ESP8266 program problem
- GaN Applications in RF and Electronics
- CC2530 Basic Experiment 1 I/O Experiment Code
- Qorvo Online Design Conference - Wi-Fi Architecture and Future Development of Wi-Fi Standards
- DC motor drive solution using TC118S domestic chip