Ich hatte mal ein Beispiel für den UART geschrieben, vielleicht hilft dir das ja schonmal weiter:
http://www.kreatives-chaos.com/index.php?seite=c_uart

MfG Kjion