控制/MCU
//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)
{
;
}
}
全部0条评论
快来发表一下你的评论吧 !