Exodus
14.06.2006, 13:17
Hallo
Kaann mir wer sagen warum dieser code nicht richtig funktionier??
Also Programm soll machen: LED von PA 0-7 verschieben, dann weiter an PB LED von PB0-3 verschieben.
.include <m8535def.inc>
.org 0x0000
rjmp Reset
.org OC0addr
rjmp Compare
Reset:
;In Register laden
ldi R17, 0b00000001
ldi R19, 8
ldi R20, 4
;Stackpointer
ldi R16, HIGH(RAMEND)
out SPH, R16
ldi R16, LOW(RAMEND)
out SPL, R16
;Compare-output
ldi R16, 255
out OCR0, R16
;Flags setzen
ldi R16, (1<<OCIE0)
out TIMSK, R16
;Flags aktivieren
sei
;Timer
ldi R16, (1<<CS00) | (1<<WGM01) | (1<<CS02)
out TCCR0, R16
sbi DDRA, 0
;Hauptprogramm
Reifen1:
out DDRA, R17
cpse R18, R19
rjmp Reifen1
clr R18
ldi R17, 0b00000001
Reifen2:
out DDRB, R17
cpse R18, R20
rjmp Reifen2
cbi DDRA, 0
clr R18
ldi R17, 0b00000001
rjmp Reifen1
Compare:
inc R18
rol R17
reti
MFG
Michael
Kaann mir wer sagen warum dieser code nicht richtig funktionier??
Also Programm soll machen: LED von PA 0-7 verschieben, dann weiter an PB LED von PB0-3 verschieben.
.include <m8535def.inc>
.org 0x0000
rjmp Reset
.org OC0addr
rjmp Compare
Reset:
;In Register laden
ldi R17, 0b00000001
ldi R19, 8
ldi R20, 4
;Stackpointer
ldi R16, HIGH(RAMEND)
out SPH, R16
ldi R16, LOW(RAMEND)
out SPL, R16
;Compare-output
ldi R16, 255
out OCR0, R16
;Flags setzen
ldi R16, (1<<OCIE0)
out TIMSK, R16
;Flags aktivieren
sei
;Timer
ldi R16, (1<<CS00) | (1<<WGM01) | (1<<CS02)
out TCCR0, R16
sbi DDRA, 0
;Hauptprogramm
Reifen1:
out DDRA, R17
cpse R18, R19
rjmp Reifen1
clr R18
ldi R17, 0b00000001
Reifen2:
out DDRB, R17
cpse R18, R20
rjmp Reifen2
cbi DDRA, 0
clr R18
ldi R17, 0b00000001
rjmp Reifen1
Compare:
inc R18
rol R17
reti
MFG
Michael