Autopilot-CVS: onboard/rev2 uart.c,2.5,2.6
Status: Alpha
Brought to you by:
tramm
|
From: Trammell H. <tr...@us...> - 2003-02-27 05:03:22
|
Update of /cvsroot/autopilot/onboard/rev2
In directory sc8-pr-cvs1:/tmp/cvs-serv14322
Modified Files:
uart.c
Log Message:
Updated UART for 16 MHz clock in Mega16
Index: uart.c
===================================================================
RCS file: /cvsroot/autopilot/onboard/rev2/uart.c,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- uart.c 22 Oct 2002 18:13:49 -0000 2.5
+++ uart.c 27 Feb 2003 05:03:19 -0000 2.6
@@ -62,6 +62,7 @@
/*
* UART Baud rate generation settings:
*
+ * With 16.0 MHz clock, UBRR=25 => 38400 baud
* With 8.0 Mhz clock, UBRR=12 => 38400 baud
* With 4.0 Mhz clock, UBRR=12 => 19200 baud
*
@@ -74,7 +75,13 @@
uart_init( void )
{
/* Baudrate is 38.4 for a 8 Mhz clock */
+#if CLOCK == 16
+ outp( 25, UBRR );
+#elif CLOCK == 8
outp( 12, UBRR );
+#else
+ #error "Unsupported clock"
+#endif
/* Enable the UART for sending and receiving */
sbi( UCSRB, RXEN );
|