uint16_t rpm, value=0; uint32_t cycle=0, trot, icr_l, icr_h; ISR(TIMER1_CAPT_vect) { TCNT1H=0; TCNT1L=0; icr_l = ICR1L; icr_h = ICR1H; trot = (((icr_h << 8) | icr_l)+65536*cycle)*300; rpm = 60000000/trot; cycle=0; } ISR(TIMER1_OVF_vect) { cycle++; }