.INCLUDE "m8515def.inc" .CSEG .ORG 0000 .equ timer=50000 ldi r16,0xFF ; Datenrichtung out DDRB,r16 ldi r16, 0x00 out DDRD, r16 ldi r16, HIGH(RAMEND) ; Stackpointer out SPH, r16 ldi r16, LOW(RAMEND) ; Stackpointer out SPL, r16 ldi r16, 0b11111011 ; Anfangszustand out PORTB, r16 main: ; Abfrageschleife sbis PIND,0 rcall rechts ; Rechts lang sbis PIND,0 rjmp main rcall links ; Links lang rjmp main time: ldi r25,HIGH(timer) ;Zeitschleife ldi r24,LOW(timer) subtime: nop nop nop sbiw r24,1 brne subtime ret links: rcall time ; Zeitschleife aufrufen sec ; C-Flag setzen, drehen, ausgeben rol r16 out PORTB, r16 sbis PORTB, 7 rcall reset ; Anfangszustand wiederherstellen, wenn "durchgelaufen" ret reset: ; Anfangszustandschleife rcall time ldi r16, 0xFE out PORTB, r16 ret rechts: ; rechts lang rcall time sec sbis PORTB,0 clc ror r16 out PORTB, r16 ret