/* * uart.c * */ #include "uart.h" char uartReceiveBuffer[UART_RECV_BUFFER_SIZE]; void uart_init() { #if defined (__AVR_ATmega8__) // enable receive and transmit UCSRB |= (1 << RXEN) | (1 << TXEN); // set frame format //Set data frame format: asynchronous mode,no parity, 1 stop bit, 8 bit size UCSRC=(1<> 8; UBRRL = UBRR_VAL & 0xFF; #elif defined (__AVR_ATmega168P__) // enable receive and transmit UCSR0B = (1<> 8; UBRR0L = UBRR_VAL; #else # if !defined(__COMPILING_AVR_LIBC__) # warning "device type not defined" # endif #endif } // ======================= SEND ======================= void uart_sendChar(char c) { #if defined (__AVR_ATmega8__) while (!(UCSRA & (1<