#include unsigned char a,b; // Timer 0 overflow interrupt service routine interrupt [TIM0_OVF] void timer0_ovf_isr(void) { TCNT0=0xAE; ++a; // Place your code here if(a==5) { a=0; PORTD.3^=1; } } // Timer 2 overflow interrupt service routine interrupt [TIM2_OVF] void timer2_ovf_isr(void) { TCNT2=0xDE; ++b; // Place your code here if(b==2) { b=0; PORTD.4^=1; } } void main(void) { PORTA=0x00; DDRA=0x00; PORTB=0x00; DDRB=0x08; PORTC=0x00; DDRC=0x00; PORTD=0x67; DDRD=0x98; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: 1000,000 kHz // Mode: Normal top=FFh // OC0 output: Toggle on compare match TCCR0=0x11; TCNT0=0xAE; OCR0=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: 1000,000 kHz // Mode: Normal top=FFh // OC2 output: Toggle on compare match ASSR=0x00; TCCR2=0x11; TCNT2=0xDE; OCR2=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x41; // Global enable interrupts #asm("sei") while (1) { // Place your code here }; }