Home
Name Modified Size InfoDownloads / Week
readme.txt 2015-02-28 1.7 kB
sUART.cpp 2015-02-28 4.3 kB
Totals: 2 Items   6.1 kB 0
Software-based UART (sUART) for AVR Atmega16
25. February 2015

Author: 
Markus Hager
TU Ilmenau
Germany

Content:
1. License
2. Purpose of this software
3. Short description




1.

This software is published under the GNU General Public License.
Use it at your own risk.
If you modify/extend/improve this software, I would appreciate if
you discuss and share your code with me. 
h a g e r - m a r k u s at g m x . d e


2.

I found many libraries on the Internet to implement a so called
software UART. Some of them did not work but most were (just)
hard to configure due to missing documentation.
This is a small example project demonstrating a sUART without
any dependancies and just one file.


3.

This project uses a Atmega16, but by checking the timer and
port configuration you can use it on any other controller, too.
The controller runs with a 14.7456 MHz crystal. I would recommand
to use something similar because with the timer prescaler this will
result in no timing error:  http://wormfood.net/avrbaudcalc.php

Configuration of the project:
f_controller = 14.7456 MHz
sUART = 1200 baud
PORTA = sUART output
PORTD_2 = sUART input
TIMER0 = used to scan (read) sUART
TIMER2 = used to write to sUART

TIMER0:
f=9600 so we have 8 samples to scan a bit on sUART
we use no falling edge interrupt, instead polling is used ...

TIMER2:
f=1200 so we directly write to PORTA on each timer cycle

The real AVR UART is configured with 115200 and used as debug feature.
Every 4 seconds you will receive a '_' symbol.
Everything received on sUART will be echoed back on this UART.

If you write a 'h' on the sUART you will receive a predefined
string on sUART.

Hope this helps!
Source: readme.txt, updated 2015-02-28