//Crystal:7.3728MHz,功用:学习外部中止0的程序
#include
#include
#defineLED_COMPORTA^=(1《voidport_init(void)
{
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)
{
;
}
}