using a prescaler (eg /64) may lead to horizontal offset errors

because 1cycle off actually means many cycles off (eg 64)
This commit is contained in:
giomba 2021-07-03 12:05:49 +02:00
parent 2abac03779
commit 77b1858311
2 changed files with 5 additions and 8 deletions

View File

@ -1,4 +1,4 @@
#pragma once
#define VERTICAL_OFFSET 30
#define HORIZONTAL_OFFSET 3
#define HORIZONTAL_OFFSET 192

11
main.S
View File

@ -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