When learning about external interrupts, because I didn’t understand them, I just pasted the program to execute them.
Speak1=~Speak1;
void ISR1_Key() interrupt 2 using 2
Speak2=~Speak2;
EA=1; //Global disconnect
EX0=1; //External interrupt 0 is on
EX1=1; //External interrupt 1 is on
IT0=1; //Edge trigger, 0 means low level trigger
IT1=0; //Edge trigger, 0 means low level trigger
while(1);
Reference address:51 External interruptions to learning
void ISR0_Key() interrupt 0 using 1
{
}
{
}
void Main()
{
}
The execution results seem a bit confusing. I don't quite understand the difference between edge triggering and level triggering. I read about it online and I can understand it, but the actual execution is different.
1. When the keyboard is pressed in the first scan, the result is the same as what we said before. Whether it is a low level trigger or a falling edge trigger, the event will be triggered. Here, the indicator light is on when it is triggered. Then the program continues to run...
2. When the program continues to run and scans the keyboard for the second time, if the key has not been released, the result will be different.
Low level trigger: The trigger condition is still at a low level. If the trigger condition is met, the event is executed and the indicator light status changes. At this time, the indicator light changes from on to off.
Falling edge trigger: The trigger condition is still at a low level. If the falling edge trigger condition is not met, the event will not be executed and the indicator light will remain on.
Haha, let’s study it tomorrow!
There are also some problems with the interrupt handler.
The interrupt service routine uses the interrupt keyword and the interrupt number (0 to 31) to determine which interrupt the interrupt service routine is handling. The using keyword is used to specify the register group used by the interrupt service routine. The usage is: using followed by a number from 0 to 3, corresponding to 4 groups of working registers. Once the working register group is specified, the default working register group will not be pushed onto the stack, which will save 32 processing cycles, because both stacking and popping require 2 processing cycles. Today, I only tried the interrupt entry method. Tomorrow, I will try the query method, which should be the same as the timer. |
Previous article:C51 Programming of External Interrupts of 51 MCU
Next article:51 Learning Timer Interrupt
- Popular Resources
- Popular amplifiers
- Dual Radar: A Dual 4D Radar Multimodal Dataset for Autonomous Driving
- The Essentials of Reinforcement Learning: Core Algorithms and TensorFlow Implementation (Feng Chao)
- A complete book on deep learning: formulas + derivations + codes + TensorFlow full case studies
- Python and machine learning practice: decision tree, ensemble learning, support vector machine and neural network algorithm detailed explanation and programming implementation
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Now we need to produce a batch of calibration cards (EEPROM 24C128 + pull-up resistors for SCL and SDA signals, a total of three components...
- CAN (Controller Area Network) bus batch data transmission based on SAEJ1939 wireless communication data transmission protocol
- Power supply output power problem
- STM32MP157A-DK1 Evaluation (4) UART and SPI Device Access
- WLAN radio frequency and channels
- What kind of IoT card is reliable?
- [RVB2601 Creative Application Development] Initially implement the perpetual calendar function of NTP clock synchronization
- Practical Tips | How to learn hardware design well? Experts teach you from theory to practice
- Overcoming the Design Challenges of Low Quiescent Current in Small Battery-Powered Devices
- Implementation of high-precision division in fixed-point DSP