Lagere Macros in eigene Datei aus
This commit is contained in:
12
macros.inc
Normal file
12
macros.inc
Normal 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
|
||||||
|
|
||||||
16
main.asm
16
main.asm
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user