From 74be66bfea16d03679b0ed52b476237309740d58 Mon Sep 17 00:00:00 2001 From: "M.Schirmer" Date: Sat, 31 May 2025 23:06:44 +0200 Subject: [PATCH] Lagere Macros in eigene Datei aus --- macros.inc | 12 ++++++++++++ main.asm | 16 ++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 macros.inc diff --git a/macros.inc b/macros.inc new file mode 100644 index 0000000..0850614 --- /dev/null +++ b/macros.inc @@ -0,0 +1,12 @@ +;======== +; Macros +;======== + +.macro left_to_right + in @0, PORTD + rol @0 + brcc PC+2 + ldi @0, 0b00000001 + out PORTD, @0 +.endmacro + diff --git a/main.asm b/main.asm index c1fdcb3..c1666e2 100644 --- a/main.asm +++ b/main.asm @@ -16,19 +16,7 @@ .org 0x0020 rjmp overflow_handler -;======== -; Macros -;======== - -.macro left_to_right - in active_led, PORTD - rol active_led - brcc PC+2 - ldi active_led, 0b00000001 - out PORTD, active_led -.endmacro - -;======== +.include "./macros.inc" init: ;-- @@ -65,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 + left_to_right active_led overflow_handler_exit: reti