Skip to content

Commit 9e6cee0

Browse files
andreasschultesbuserror
authored andcommitted
fix timer is not triggered at ocr==0
1 parent 5715c08 commit 9e6cee0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

simavr/sim/avr_timer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,13 @@ avr_timer_configure(
498498
__FUNCTION__, p->name, top, 'A'+compi, ocr);
499499
}
500500
}
501-
if (ocr && ocr <= top) {
501+
if (ocr <= top) {
502502
p->comp[compi].comp_cycles = comp_cycles;
503503

504504
if (p->trace & (avr_timer_trace_compa << compi)) printf(
505505
"TIMER: %s-%c %c %.2fHz = %d cycles\n",
506506
__FUNCTION__, p->name,
507-
'A'+compi, resulting_clock / ocr,
507+
'A'+compi, resulting_clock / (ocr+1),
508508
(int)comp_cycles);
509509
}
510510
}

0 commit comments

Comments
 (0)