| AVR Z-LINKŪ | |||||
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/ 00024 /* === Includes ============================================================ */ 00025 00026 #include"usart.h" 00027 /* ==== Macros ============================================================= */ 00028 /* === Typedefs ============================================================ */ 00029 /* === Variables =========================================================== */ 00030 /* === Prototypes ========================================================== */ 00031 /* === Implementation ====================================================== */ 00032 00039 void uartInitialization( const baudRate_t rate ){ 00040 00041 //Initialize USART module. 00042 UBRR0H = 0x00; 00043 UBRR0L = rate; 00044 00045 //Enable USART transmitter module. Always on. 00046 ENABLE_RECEIVER; 00047 ENABLE_TRANSMITTER; 00048 00049 //8-N-1. 00050 UCSR0C |= ( 1 << UCSZ01 ) | ( 1 << UCSZ00 ); 00051 00052 ENABLE_RECEIVE_COMPLETE_INTERRUPT; 00053 00054 return; 00055 } 00056 00057 00066 void uartSendSymbol( const uint8_t symbol ){ 00067 00068 //Wait until the USART module is ready to 00069 //transmit a new symbol. 00070 for( ; !( UCSR0A & ( 1 << UDRE0 ) ); ){ 00071 00072 ; 00073 } 00074 00075 //Put symbol in data register. 00076 UDR0 = symbol; 00077 00078 return; 00079 }
Generated on Sat Dec 2 16:05:51 2006 for AVR414 User's Guide - ATAVRRZ502 - Accessory Kit by 1.4.7
|