m820241212RS232TRANSMIT.asm


;; (C) David Vajda
;; 2024-12-12
;; RS232 Transmit

.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16


ldi r16, HIGH (25)
out UBRRH, r16
ldi r16, LOW (25)
out UBRRL, r16

;; Rechnung - teiler 16 - CPU-clock (16 * Baudrate) -1

ldi r16, (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0)
out UCSRC, r16
ldi r16, (1 << TXEN)
out UCSRB, r16

loop1:
ldi r16, 'd'
rcall rs232transmit
ldi r16, 'a'
rcall rs232transmit
ldi r16, 'v'
rcall rs232transmit
ldi r16, 'i'
rcall rs232transmit
ldi r16, 'd'
rcall rs232transmit
ldi r16, '@'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, '.'
rcall rs232transmit
ldi r16, 'i'
rcall rs232transmit
ldi r16, 't'
rcall rs232transmit
ldi r16, 'u'
rcall rs232transmit
ldi r16, 'e'
rcall rs232transmit
ldi r16, 'n'
rcall rs232transmit
ldi r16, 'i'
rcall rs232transmit
ldi r16, 'x'
rcall rs232transmit
ldi r16, '.'
rcall rs232transmit
ldi r16, 'd'
rcall rs232transmit
ldi r16, 'e'
rcall rs232transmit
ldi r16, 10
rcall rs232transmit
ldi r16, 13
rcall rs232transmit
rjmp loop1

rs232transmit:
sbis UCSRA, UDRE
rjmp rs232transmit
out UDR, r16
ret

Image Screenshot_20241212_081855