philiph
16.12.2006, 16:56
Also ich würde gerne einen Rs232 Empfangs Interrupt programmieren und ich habe das so versucht leider geht das so nicht hat vieleicht jemand ne Idee?
.include "tn2313def.inc"
.def temp = r16
.equ CLOCK = 8000000
.equ BAUD = 9600
.equ UBRRVAL = CLOCK/(BAUD*16)-1
.org 0x00
rjmp main
.org 0x0007 rjmp USART0_RXC
main:
ldi temp, LOW(RAMEND)
out SPL, temp
ldi temp, LOW(UBRRVAL)
out UBRRL, temp
ldi temp, HIGH(UBRRVAL)
out UBRRH, temp
sbi UCSRB, RXEN
sbi UCSRB,TXEN
ldi temp, (1<<USBS)|(3<<UCSZ0)
out UCSRC,temp
sei
loop:
rjmp loop
serout:
sbis UCSRA,UDRE
rjmp serout
out UDR, temp
ret
USART0_RXC:
ldi temp, '1'
rcall serout
ldi temp, '2'
rcall serout
sei
reti
.include "tn2313def.inc"
.def temp = r16
.equ CLOCK = 8000000
.equ BAUD = 9600
.equ UBRRVAL = CLOCK/(BAUD*16)-1
.org 0x00
rjmp main
.org 0x0007 rjmp USART0_RXC
main:
ldi temp, LOW(RAMEND)
out SPL, temp
ldi temp, LOW(UBRRVAL)
out UBRRL, temp
ldi temp, HIGH(UBRRVAL)
out UBRRH, temp
sbi UCSRB, RXEN
sbi UCSRB,TXEN
ldi temp, (1<<USBS)|(3<<UCSZ0)
out UCSRC,temp
sei
loop:
rjmp loop
serout:
sbis UCSRA,UDRE
rjmp serout
out UDR, temp
ret
USART0_RXC:
ldi temp, '1'
rcall serout
ldi temp, '2'
rcall serout
sei
reti