#include int a; #asm .equ __lcd_port=0x12 ;PORTD #endasm #include #include interrupt [TIM2_OVF] void timer2_ovf_isr(void) { a++; if(a==2){ a=0; TCNT2=0; } } char str[20]; void main(void) { int b,c,d; PORTB=0x00; DDRB=0x00; PORTC=0x00; DDRC=0x00; PORTD=0x00; DDRD=0x00; ASSR=0x08; TCCR2=0x02; TCNT2=0x00; OCR2=0x00; TIMSK=0x40; lcd_init(16); #asm("sei") while (1) { if ((a==0) && (PINB.0==1)){ b++; d=1; } if ((a==1) && (PINB.0==0)){ if(d==1){ c=b; b=0; d=0; } } lcd_gotoxy(0,0); sprintf(str,"%u",c); lcd_puts(str); if (c<10){ lcd_gotoxy(1,0); lcd_putsf(" "); } }; }