AVR microcontroller interrupt and interrupt keyboard usage

Publisher:心若水仙Latest update time:2015-12-30 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
one,

The interrupt process is not described in detail. The function is generally used for

Real-time handler  : fast execution                - interrupt keyboard

Time-sharing operation      : perform other functional modules      - uart spi

Fault handling      : also considered part of real-time processing    - power-off handling

Standby wake-up      : can work at low power consumption      

 

Terms used     interrupt source    interrupt flag    interrupt response    request signal    service procedure  

The process of using interrupts:    Global interrupts run.  The interrupt flag    of this module is enabled  .  

 

AVR interrupt vector (address) needs to occupy space, generally 1-2 words  

ATMEGA128 has 35 interrupt sources 

two,

Interrupt response process

It is necessary to clear the global interrupt and  clear the interrupt protection   of this module  to enter the corresponding service program 

Generally, it takes 6-8 clock cycles    to complete the process.

 

3. External Interrupt

Four trigger modes

Rising edge trigger   Falling edge trigger   Any level change trigger    Low level trigger

 

void Init_Int0(void)
{
  CLI();             //disable all interrupts
  EICRA |= (1<<1);   //Set external interrupt 0 falling edge trigger     to 00000010
    EICRA &= ~(1<<0);  //This is divided into two times to avoid affecting other interrupts. A maximum of 2 times is sufficient.
  SEI_INT0();        //Enable INT0; 
  SEI();             //re-enable interrupts
}

Reference address:AVR microcontroller interrupt and interrupt keyboard usage

Previous article:AVR MCU Internal EEPROM Detailed Explanation
Next article:Reading and Writing EEPROM of AVR Microcontroller

Latest Microcontroller Articles
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号