Gast
#107969
Hi,
habe versucht das beispiel UART programm vom atmega8 auf den atmega128
umzuschreiben, ging aber nicht so ganz :)
Bin auch ne echter neuling in diesem gebiet !
--------------------------------------------------
.include "m128def.inc"
.def temp = r16
.equ CLOCK = 16000000
.equ BAUD = 19200
.equ UBRRVAL = CLOCK/(BAUD*16)-1
; Stackpointer initialisieren
ldi temp, LOW(RAMEND)
out SPL, temp
ldi temp, HIGH(RAMEND)
out SPH, temp
; Baudrate einstellen
ldi temp, LOW(UBRRVAL)
out UBRR0L, temp
sbi UCSR0B,TXEN ; TX aktivieren
loop: ldi temp, 'T'
rcall serout ; Unterprogramm aufrufen
ldi temp, 'e'
rcall serout ; Unterprogramm aufrufen
ldi temp, 's'
rcall serout ; ...
ldi temp, 't'
rcall serout
ldi temp, '!'
rcall serout
ldi temp, 10
rcall serout
ldi temp, 13
rcall serout
rjmp loop
serout:
sbis UCSR0A,UDRE0 ; Warten bis UDR für das
nächste
; Byte bereit ist
rjmp serout
out UDR0, temp
ret ; zurück zum Hauptprogramm
--------------------------------------------------
so "müsste" es doch funktionieren ? oder ? bei mir kommt aber nur
zeichensalat an der rs-232 an !
Danke für brauchbare tipps :)
MfG Hans