#include #include #include #include #include #define UART_MAXSTRLEN 5 #define F_CPU 8000000 #define BAUD 19200 #include static volatile bool uart_dataReceived_b = false; static volatile char uart_data_c[UART_MAXSTRLEN + 1] = {0}; static void uart_transmit( unsigned char data ) { while(!(UCSR0A & (1< uart_dataReceivedLength_u8)) { uart_data_c[uart_dataReceivedLength_u8] = nextChar_c; uart_dataReceivedLength_u8++; } else { uart_data_c[uart_dataReceivedLength_u8] = '\0'; uart_dataReceivedLength_u8 = 0; // uart_dataReceived_b = true; } } } int main(void) { uart_init(); sei(); uart_sendString("start\n"); while (1) { if(uart_dataReceived_b) { uart_sendString(uart_data_c); uart_dataReceived_b = false; } } }