From 35f27285b51784ecee0e51518fb2a6c0b3c152d2 Mon Sep 17 00:00:00 2001 From: Tibor Peluch Date: Thu, 1 Sep 2016 22:33:24 +0200 Subject: [PATCH] timer: fix calculation of comp_cycles - bsekisser was right, there must be ocr+1 --- simavr/sim/avr_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.39.5