; Ausgabe eines Textes über die serielle Schnittstelle ; Programm beinhaltet Taster-LED-Kopplung als Lebenzeichen ; ; Achim Walther, www.voidpointer.de, 20.11.2004 .include "m8def.inc" .def temp = r16 .equ CLOCK = 8000000 .equ BAUD = 9600 .equ UBRRVAL = CLOCK/(BAUD*16)-1 ; Taster und LED init ldi temp, 0xFF out DDRC, temp ;Port C durch Ausgabe von 0xFF ins ;Richtungsregister DDRC als Ausgang konfigurieren ldi temp, 0x00 out DDRD, temp ;Port D durch Ausgabe von 0x00 ins ;Richtungsregister DDRD als Eingang konfigurieren ldi temp, 0xFF out PORTC, temp ;PORTC auf 0xFF setzen -> alle LEDs aus ; 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< 1. LED an sbic PIND, 7 ; wenn Taste gedrückt nichts tun sbi PORTC, 0 ; LED aus 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