// Timer 1 input capture interrupt service routine interrupt [TIM1_CAPT] void timer1_capt_isr(void) //SMT160-30 0-85° {static unsigned int icp_bak_low, icp_bak_hi; static unsigned char count; static unsigned long periode, hi_time; TCCR1B=TCCR1B ^ 0b01000000; //toggle edge select if (TCCR1B & 0b01000000) //was falling edge {periode=periode + (int)(ICR1 - icp_bak_low); hi_time=hi_time+(int)(ICR1-icp_bak_hi); icp_bak_low=ICR1; count++; if (count>20) // {count=0; sensor = (100000*hzeit/periodendauer-32000); //result, divide by 47 for °C *10 //*9/5/47 +32 for °F *10 periode=0; //reset hi_time=0; //reset } } else icp_bak_hi=ICR1; }