External interrupt 0 or 1 is essentially the same, only EX and IT are changed to 0 or 1.
Q: So the question is: Why do we have two very similar external interrupts 0 or 1?
A: When there are two external interrupts, if there is only one external interrupt,
Then when one interrupt handles two external interrupts, its CPU processing is not accurate enough.
Therefore, we need to open another channel to handle external interrupts.
Q: What if there are three external interrupts?
A: This is the limitation of the microcontroller. Haha~~ But the flight control has many interrupts
#include
/*
* External interrupt 0
*/
sbit LED = P2^0; //bit declaration
//Register initialization function
void kinson()
{
EX0 = 1; // External interrupt 0 switch
EA = 1; //Interrupt the main switch
IT0 = 1; //External interrupt 0 trigger mode: 0 is level, 1 is falling edge //The timer is to be started
}
//Main function
void main(void)
{
kinson(); //Calling the register initialization function
while(1); //Let the program loop infinitely here
}
//Interrupt
void xjx() interrupt 0 //The interrupt number of external interrupt 0 is 0, and the interrupt number of external interrupt 1 is 2
{
LED = ~LED; //The LED turns on and off because of each interrupt
}
#include
/*
* External interrupt 1
*/
sbit LED = P2^0; //bit declaration
//Register initialization function
void kinson()
{
EX1 = 1; // External interrupt 0 switch
EA = 1; //Interrupt the main switch
IT1 = 1; //External interrupt 0 trigger mode: 0 is level, 1 is falling edge //The timer is to be started
}
//Main function
void main(void)
{
kinson(); //Calling the register initialization function
while(1); //Let the program loop infinitely here
}
//Interrupt
void xjx() interrupt 2 //The interrupt number of external interrupt 0 is 0, and the interrupt number of external interrupt 1 is 2
{
LED = ~LED; //The LED turns on and off because of each interrupt
}
Previous article:LCD with character display I LOVE YOU
Next article:Digital tube buttons plus or minus one
Recommended ReadingLatest update time:2024-11-25 04:41
- 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)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- CATL releases October battle report
- Battery industry in October 2024: growth momentum remains unabated!
- Mercedes-Benz will launch the eCitaro equipped with NMC4 batteries to provide high energy density and long life
- Many companies have announced progress on solid-state batteries. When will solid-state batteries go into mass production?
- Xsens Sirius Series Inertial Sensors Enable 3D Inertial Navigation in Harsh Environments
- Infineon's Automotive Landscape: From Hardware to Systems
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- What are the upgrades and improvements of Altium Designer 19 compared to AD18?
- Practical equivalent models of resistors, capacitors, and inductors
- E840-DTU Unboxing
- Switching Power Supply Design
- Is the temperature gauge of a mechanical multimeter smaller than that of a digital multimeter?
- Linux power management detailed explanation
- Preparations for the 2020 Automechanika Shanghai exhibition are progressing smoothly. Get the latest news
- This ISOW7321 isolation chip gets a little hot during actual testing, and the 5V power supply shows an input current of 200mA. Is this normal?
- Evaluation report summary: Anxinke ESP32-Audio-Kit free evaluation trial
- Power quality