; This is a simple demonstration of sending characters via the 2313 UART. ; Here we are using a clock speed of 3.6864 MHz. The UBRR setting depends ; on the clock speed and baud rate. ; The program scrolls a continuous stream of characters when connected a terminal ; by sending all the printable characters from 32 to 123 decimal or whatever ; values are stored initially in char and in upper. This program was intended ; mainly to show the performance of serial I/O on the AVR. Very impressive ; throughput is possible. Without the delay it can overrun a PC serial port. ; The delay just makes the scrolling go slower so you can read it. Can do 115K ; baud with just a 3.6864 MHz clock on the AVR! ; ; Written by Brian Hammill 5/98 ; This code is given as is and placed in the public domain. No warranty of any kind ; is implied or given. Questions or comments about the code may be directed ; to me via Email: hammill@email.exide.com. I don't promise to support this ; code, but will offer suggestions as my schedule allows. Good luck. .include "2313def.inc" .def Temp =r16 ;temporary register .def Delay =r17 .def Delay2 =r18 .def upper =r19 .def char =r20 ;***** Initialization ; RESET: ldi Temp, $18 out UCR, Temp ldi char, 32 ; start with '0' ldi upper, 123 ; determine the baud rate from the clock freq. using the formula: ; BAUD = Fck/16*(UBRR + 1) ; 3.6864 (or multiples of) give nice baud rates with no errors. ;ldi Temp, 95 ; Baud Rate = 2400 at 3.6864 MHz ;ldi Temp, 1 ; Baud Rate = 115200 ldi Temp, 190 ; Baud Rate = 1200 out UBRR, Temp LOOP1: out UDR, char ; output char to UART Data Reg inc char ; next char DLY: dec Delay dec Delay inc Delay brne DLY dec Delay2 brne DLY ;inc char cp upper, char brne LOOP1 ldi char, 32 rjmp LOOP1