m820241127005RS232RxD.asm


; (C) David Vajda
; RS232, 2400 Bd, Recieve, USART, Atmega8
; 2024-11-27

.include "m8def.inc"

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

ldi r16, 0xff
out DDRB, r16

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

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

ldi r16, (1 << RXEN)
out UCSRB, r16

rcall rs232recieve
end: rjmp end

rs232recieve:
sbis UCSRA, RXC
rjmp rs232recieve
in r16, UDR
com r16
out PORTB, r16
rjmp rs232recieve