AVR Atmega16外部中断0的简点应用
时间:2018-12-13 15:20:02
[导读]#include #include #include interrupt.h>void port_init(void){ DDRB = 0xff; PORTB = 0xff; DDRD = 0x00; PORTD |= (1
#include
#include
#include interrupt.h>
void port_init(void)
{
DDRB = 0xff;
PORTB = 0xff;
DDRD = 0x00;
PORTD |= (1 << 2);
}
int main(void)
{
port_init();
GICR |= (1 << INT0);
sei();
while(1)
{
;
}
}
ISR(INT0_vect)
{
PORTB = 0xfe;
_delay_ms(500);
PORTB = 0xff;
_delay_ms(500);
}





