ATMega16单片机外部中断的使用

//Crystal:7.3728MHz,功能:学习外部中断0的程序
#include
#include
#defineLED_COMPORTA^=(1{
PORTA=0x40;
DDRA=0x40;
PORTB=0x00;
DDRB=0x00;
PORTC=0x00;//m103outputonly
DDRC=0x00;
PORTD=0x04;
DDRD=0x00;
}

#pragmainterrupt_handlerint0_isr:2
voidint0_isr(void)
{
LED_COM;
}

//callthisroutinetoinitializeallperipherals
voidinit_devICes(void)
{
//stoperrantinterruptsuntilsetup
CLI();//dISAbleallinterrupts
port_init();

MCUCR=0x00;
GICR=0x40;
TIMSK=0x00;//timerinterruptsources
SEI();//re-enableinterrupts
//allperipheralsarenowinitialized
}

voidmain()
{
init_devices();
while(1)
{
;
}

}
【ATMega16单片机外部中断的使用】

    推荐阅读