-
HI
hast Du die Massen verheiratet? Ich hab mir mal nen Wolf gesucht weil ich offensichtlichen Datenmüll hatte. Am ende war das problem das sich die Massen net kannten :-(
Alternativ halt noch so Sachen wie start/stopbits parity etc. checken aber ich vermute das hast Du eh schon gemacht.
Weiterhin viel Glück.
Tobi
-
Code:
.include "m16def.inc"
.def temp = R16
.equ CLOCK = 3686000
.equ BAUD = 9600
.equ UBRRVAL = CLOCK/(BAUD*16)-1
.org 0x00
rjmp main
.org 0x0016
rjmp int_rxc
; Hauptprogramm
main:
ldi temp, LOW(RAMEND)
out SPL, temp
ldi temp, HIGH(RAMEND)
out SPH, temp
ldi temp, 0xFF ; Port B = Ausgang
out DDRB, temp
;
; Baudrate einstellen
ldi temp, LOW(UBRRVAL)
out UBRRL, temp
ldi temp, HIGH(UBRRVAL)
out UBRRH, temp
; Frame-Format: 8 Bit
ldi temp, (1<<URSEL)|(3<<UCSZ0)
out UCSRC, temp
sbi UCSRB, RXCIE ; Interrupt bei Empfang
sbi UCSRB, RXEN ; RX (Empfang) aktivieren
sei ; Interrupts global aktivieren
loop:
rjmp loop ; Endlosschleife
; Interruptroutine: wird ausgeführt sobald ein Byte über das UART empfangen wurde
int_rxc:
in temp, UDR
out PORTb, temp
reti
probiers mal so vieleicht fuktzs ja
-
Code:
.include "m16def.inc"
.def temp = r16
.equ CLOCK = 3868000
.equ BAUD = 9600
.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 UBRRL, temp
ldi temp, HIGH(UBRRVAL)
out UBRRH, temp
; Frame-Format: 8 Bit
ldi temp, (1<<URSEL)|(3<<UCSZ0)
out UCSRC, temp
sbi UCSRB,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 UCSRA,UDRE ; Warten bis UDR für das nächste
; Byte bereit ist
rjmp serout
out UDR, temp
ret ; zurück zum Hauptprogramm
-
Hallo!
Mal eine andere Frage: wie müssen denn die Settings beim Terminal sein ? Ich fummel mir schon seit Stunden einen Wolf...
-
eigentlich gar nicht so schwer
com1 normalerwiese als schnitstelle baudrate 9600 datenbits 8 parität keine flusssteuerung keine
-
Naja, bei mir ist es COM6, weil ich eine PCMCIA Karte mit zwei seriellen Schnittstellen habe. Aber die Einstellungen scheinen Standard zu sein, es muss also am Programm des MC liegen.