From 81030bade3aa96e73fefd03872f0366d438df9ca Mon Sep 17 00:00:00 2001 From: Railz Date: Thu, 7 Mar 2019 19:13:45 +0100 Subject: [PATCH] Fixed signalOutput set to deactivated (nextTick = 0), but right after getting set a nextTick (so its active again) --- Geigerzaehler/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } } }