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
Lesezeichen