Hello I'm trying to count how many times the interrupt has been executed here is my code it freezes when i push button I dont know anything about flags BTW any suggestions ? ..
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <avr/io.h>
#include <avr/interrupt.h>// allways include if using interrupts
#include <util/delay.h>
#define F_CPU 8000000
#define Delay 15
#define cycles 100
LiquidCrystal_I2C lcd(0x27,16,2);//-ISR-****
ISR(INT0_vect)
{
for(int i=0;i<=50;i++)
{
_delay_ms(20);
PORTB=0x1;
_delay_ms(20);
PORTB=0x0;
_delay_ms(20);
PORTA=0x1;
_delay_ms(20);
PORTA=0x0;}
}
//*******END_OF_ISRint main(void)
{DDRA=0x1;
DDRB=0x1;
sei();//global interrupt enableGICR |= (1<<INT0);//turn on INT0
MCUCR =(1<<ISC01 | 0<<ISC00);// interrupt on rising edge//setup data ports
DDRB=0x1;while(1)
{
_delay_ms(500);
PORTB=0x1;
_delay_ms(500);
PORTB=0x0;}
}