#include #define F_CPU 4000000UL//4MHz #include #include #include volatile int flag = 0; volatile int a = 0; volatile int b = 0; //Interrupt wird alle 20ms aufgerufen ISR (TIMER1_CAPT_vect) { //PORTB ^= (1 << PB7); flag = 1; } // zweiter Interrupt ISR (TIMER0_OVF_vect) { //PORTB ^= (1 << PB7); //b++; } int main(void) { DDRB = 0xff; DDRA = 0; DDRD = 0; ICR1 = 20000; OCR1A = 1000; OCR1B = 500; TCCR1A = (1 << COM0A0) | (1 << COM0A1) | (1 << COM0B0) | (1 << COM0B1) | (1 << WGM11); TCCR1B = (1 << CS10) | (1 << WGM13) | (1 << WGM12); TCCR0A = 0; TCCR0B = (1 << CS02) | (1 << CS00); TIMSK = (1 << OCIE1A) | (1 << OCIE1B) | (1 << ICIE1) | (1 << TOIE0); sei(); //int sreg = 0; int i = 0; while (1){ if(flag){ flag = 0; //LED blinkt nicht, mit Oszi kein toggeln feststellbar i++; if (i > 100) { PORTB ^= (1 << PB7); i = 0; } }} }