#include #include #include #include #include #include void PWMinit(void){ DDRD = 0x00; //Port als Ausgang schalten TCCR1B |= (1 << ICES1); //steigende Flanke TCCR1B |= 0x01; //Counter zählt mit E-Clock TIMSK = 0x08; //Input Capture Interrupt aktivieren SREG |= 0x80; //General interrupt enable TIFR = (1 << ICF1); //Interrupt Flag loeschen } INTERRUPT (SIG_INPUT_CAPTURE1){ PORTB = 0xAA; //zu testzwecken bitmuster an LEDs ausg } void main(void){ DDRB = 0xFF; PWMinit(); while(1){} }