Lagere Macros in eigene Datei aus

This commit is contained in:
2025-05-31 23:06:44 +02:00
parent a4b3a1f2ad
commit 74be66bfea
2 changed files with 14 additions and 14 deletions

12
macros.inc Normal file
View File

@@ -0,0 +1,12 @@
;========
; Macros
;========
.macro left_to_right
in @0, PORTD
rol @0
brcc PC+2
ldi @0, 0b00000001
out PORTD, @0
.endmacro

View File

@@ -16,19 +16,7 @@
.org 0x0020 .org 0x0020
rjmp overflow_handler rjmp overflow_handler
;======== .include "./macros.inc"
; Macros
;========
.macro left_to_right
in active_led, PORTD
rol active_led
brcc PC+2
ldi active_led, 0b00000001
out PORTD, active_led
.endmacro
;========
init: init:
;-- ;--
@@ -65,7 +53,7 @@ overflow_handler:
cpi overflows, 246 ; bei ~980 Überläufe/Sekunde entsprechen 245 Überläufe ca. 250ms 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 brne overflow_handler_exit ; early Return wenn Schwellenwert noch nicht erreicht
clr overflows ; Überlaufzähler kontrolliert zurücksetzen clr overflows ; Überlaufzähler kontrolliert zurücksetzen
left_to_right left_to_right active_led
overflow_handler_exit: overflow_handler_exit:
reti reti