From 77b185831178029b114329116a8dda01ac40755f Mon Sep 17 00:00:00 2001 From: giomba Date: Sat, 3 Jul 2021 12:05:49 +0200 Subject: [PATCH] using a prescaler (eg /64) may lead to horizontal offset errors because 1cycle off actually means many cycles off (eg 64) --- const.h | 2 +- main.S | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/const.h b/const.h index b961f5c..fe2112f 100644 --- a/const.h +++ b/const.h @@ -1,4 +1,4 @@ #pragma once #define VERTICAL_OFFSET 30 -#define HORIZONTAL_OFFSET 3 +#define HORIZONTAL_OFFSET 192 diff --git a/main.S b/main.S index 3106da5..d1dbfe2 100644 --- a/main.S +++ b/main.S @@ -32,7 +32,7 @@ main: ldi r16, 0x02 ; don't connect output pins to timer, CTC[1:0] mode sts TCCR0A, r16 - ldi r16, 0x03 ; CTC[2] mode, prescaler /64 + ldi r16, 0x01 ; CTC[2] mode, no prescaler sts TCCR0B, r16 ; init variables @@ -112,17 +112,14 @@ int_timer_0: sbi IO(PORTB), 4 nop - cbi IO(PORTB), 4 nop - sbi IO(PORTB), 4 nop - cbi IO(PORTB), 4 nop - sbi IO(PORTB), 4 nop - cbi IO(PORTB), 4 nop - sbi IO(PORTB), 4 + nop + nop + nop nop cbi IO(PORTB), 4