.include "4433def.inc" ;--------------------------------------------------------- ; Register mit Variablen benennen .def tmp = r16 ; für alles ;--------------------------------------------------------- ; Initialisierung UART ldi tmp, RAMEND out SPL, tmp sbi UCSRB, TXEN ; TX aktivieren ldi tmp, 4000000/(9600*16)-1 ; Baudrate 9600 out UBRR, tmp ;--------------------------------------------------------- ;========================================================= main: rcall t_1 rcall wait200ms rjmp main ;========================================================= ;--------------------------------------------------------- ; Zeichenkette: "80 04 BF 02 00" t_1: ldi tmp, 0x80 rcall send ; HIER PAUSE ldi tmp, 0x04 rcall send ; HIER PAUSE ldi tmp, 0xBF rcall send ; HIER PAUSE ldi tmp, 0x02 rcall send ; HIER PAUSE ldi tmp, 0x00 rcall send ret ;--------------------------------------------------------- ;--------------------------------------------------------- send: sbis UCSRA, UDRE ; Warten, bis UDR bereit rjmp send out UDR, tmp ; Zeichen (tmp) senden ret ;--------------------------------------------------------- ;--------------------------------------------------------- ;wait100us: ; ldi R17, $1F ;WGLOOP0: ldi R18, $2A ;WGLOOP1: dec R18 ; brne WGLOOP1 ; dec R17 ; brne WGLOOP0 ; nop ;ret ;--------------------------------------------------------- ;--------------------------------------------------------- wait200ms: ldi R17, $5F WG200LOOP0: ldi R18, $17 WG200LOOP1: ldi R19, $79 WG200LOOP2: dec R19 brne WG200LOOP2 dec R18 brne WG200LOOP1 dec R17 brne WG200LOOP0 ldi R17, $01 WG200LOOP3: dec R17 brne WG200LOOP3 nop nop ret ;---------------------------------------------------------