AVR单片的外部中断应用设计

#include

#include

#include interrupt.h》

void port_init(void)

{

DDRB = 0xff;

PORTB = 0xff;

DDRD = 0x00;

PORTD |= (1 《《 2);


AVR单片的外部中断应用设计

}

int main(void)

{

port_init();

GICR |= (1 《《 INT0);

sei();

while(1)

{

;

}

}

ISR(INT0_vect)

{

PORTB = 0xfe;

_delay_ms(500);

PORTB = 0xff;

_delay_ms(500);

}

  • AVR单片的外部中断应用设计已关闭评论
    A+
发布日期:2019年07月14日  所属分类:参考设计