51 External interruptions to learning

Publisher:心灵律动Latest update time:2016-01-18 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
When learning about external interrupts, because I didn’t understand them, I just pasted the program to execute them.
void ISR0_Key() interrupt 0 using 1
{
 Speak1=~Speak1;            
}
 
 void ISR1_Key() interrupt 2 using 2
{
 Speak2=~Speak2;            
}  
 
void Main()
{    
     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);
}
 
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.

Reference address:51 External interruptions to learning

Previous article:C51 Programming of External Interrupts of 51 MCU
Next article:51 Learning Timer Interrupt

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号