Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

/*

* Interrupt.c
*
* Author : Brahian Cubillos
*/

#define F_CPU 16000000UL

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

int main(void)
{
/*Control de MCU y Registro de estados*/
MCUCR = (1<<ISC01)|(0<<ISC00); // INT0 se dispara con flanco de
bajada
/*Registro genereal de control de interrupcin*/
GICR = (1<<INT0); // INT0 habilitada
DDRC = 0x03;
DDRD = 0x00;
PORTD = 0x04; // Habilito Resistencia de pull up
sei(); // Habilitador de interrupcin... cli(); Deshabilitador de interrupcin
/* Replace with your application code */
while (1)
{
PORTC = 0x02;
}
}

ISR(INT0_vect){
PORTC = 0x01;
_delay_ms(100);
GIFR = (1<<INTF0); // Reinicio la bandera de interrupcin
}

You might also like