diff --git a/Geigerzaehler/main.c b/Geigerzaehler/main.c index c5241cc..e875e7e 100644 --- a/Geigerzaehler/main.c +++ b/Geigerzaehler/main.c @@ -92,6 +92,10 @@ int main() PORTD |= (1 << PORTD5); PORTD |= (1 << PORTD6); signalOutput_nextHigh = 0; // Next is low + + // When the signal should stop + signalOutput_nextTick = TCNT1 + F_CPU/timer1_prescaler * signalOutput_time/1000; // nextTick is in signalOutput_time in ms + if(signalOutput_nextTick == 0) signalOutput_nextTick++; // If its 0, it stops, we dont want that } else // Set it low { @@ -101,10 +105,6 @@ int main() signalOutput_nextTick = 0; // Disable signalOutput } - - // When the signal should stop - signalOutput_nextTick = TCNT1 + F_CPU/timer1_prescaler * signalOutput_time/1000; // nextTick is in signalOutput_time in ms - if(signalOutput_nextTick == 0) signalOutput_nextTick++; // If its 0, it stops, we dont want that } } }