From 2c239dd8e4f6656b3e53e22118154638c6a36887 Mon Sep 17 00:00:00 2001 From: "M.Schirmer" Date: Sat, 31 May 2025 23:23:37 +0200 Subject: [PATCH] =?UTF-8?q?Schlie=C3=9Fe=20=C3=9Cbungsziel=20Stage=202,=20?= =?UTF-8?q?Punkt=202=20ab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- macros.inc | 8 ++++++++ main.asm | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e98b15d..b69a9d9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## Stage 2: - [x] Hardcodiertes Lauflicht L2R Richtung -- [ ] Hardcodiertes Lauflicht R2L Richtung +- [x] Hardcodiertes Lauflicht R2L Richtung ## Stage 3: diff --git a/macros.inc b/macros.inc index 0850614..380ef4b 100644 --- a/macros.inc +++ b/macros.inc @@ -10,3 +10,11 @@ out PORTD, @0 .endmacro +.macro right_to_left + in @0, PORTD + ror @0 + brcc PC+2 + ldi @0, 0b10000000 + out PORTD, @0 +.endmacro + diff --git a/main.asm b/main.asm index c1666e2..982782c 100644 --- a/main.asm +++ b/main.asm @@ -53,7 +53,7 @@ overflow_handler: cpi overflows, 246 ; bei ~980 Überläufe/Sekunde entsprechen 245 Überläufe ca. 250ms brne overflow_handler_exit ; early Return wenn Schwellenwert noch nicht erreicht clr overflows ; Überlaufzähler kontrolliert zurücksetzen - left_to_right active_led + right_to_left active_led overflow_handler_exit: reti