From: Tibor Peluch Date: Thu, 1 Sep 2016 20:33:24 +0000 (+0200) Subject: timer: fix calculation of comp_cycles X-Git-Tag: v1.4~9^2~2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=35f27285b51784ecee0e51518fb2a6c0b3c152d2;p=sx%2Fsimavr.git timer: fix calculation of comp_cycles - bsekisser was right, there must be ocr+1 --- diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index dba4e9b..779ce66 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -299,7 +299,7 @@ avr_timer_configure( if (!p->comp[compi].r_ocr) continue; uint32_t ocr = _timer_get_ocr(p, compi); - uint32_t comp_cycles = clock * ocr; + uint32_t comp_cycles = clock * (ocr + 1); p->comp[compi].comp_cycles = 0;