.equ xtal = 9216 ; XTAL frequency, KHz
.equ baud = 9600 ; UART Baud rate
.def temp = r16
.cseg
ldi temp,(xtal*1000)/(16*baud)-1 ; Calculate and set the UBRR value for given XTAL & Baud figures
out UBRRL, temp
ldi temp,3 << UCSZ0 ; 8N1
out UCSRC,temp
ldi temp,1 << TXEN ; Enable transmit
out UCSRB,temp
ldi temp,'5'
forever:
sbis UCSRA,UDRE ; UDRE is "1" after reset
rjmp forever
out UDR,temp ; Send a byte
rjmp forever