//----------------------------------------------------------------------------- #include "usart.h" #include //----------------------------------------------------------------------------- #ifdef USART_USE_RX_IRQ U08 usart_rx_buffer[USART_RX_BUFFER_SIZE]; //U08 *usart_rx_buffer_ptr = &usart_rx_buffer[0]; U08 usart_received_chars; volatile BOOL usart_rx_ready = false; static U08 usart_rx_buffer_index = 0; static U08 usart_receive_char; static BOOL usart_receive_suspended = false; volatile BOOL ISR_toggle_out = false; #endif //----------------------------------------------------------------------------- void usart_init(void) { USART_SET_BAUDRATE(USART_BAUDRATE); UCSRA = 0x00; UCSRB = 0x00; // Disable receiver and transmitter and interrupts #ifdef USART_USE_RX UCSRB |= (1 << RXEN); // Turn on receiver DDRD &= ~(1<= 'a' && usart_receive_char <= 'z') { usart_receive_char -= 32; } #endif if (usart_rx_buffer_index < USART_RX_BUFFER_SIZE - 1) // Store character { usart_rx_buffer[usart_rx_buffer_index++] = usart_receive_char; usart_writeln_str(usart_rx_buffer); } #endif //usart_write_char(usart_rx_buffer[usart_rx_buffer_index]); //usart_writeln_str(usart_rx_buffer); //usart_write_char(usart_rx_buffer[1,2]); //usart_write_char(usart_rx_buffer[usart_rx_buffer_index]); //usart_writeln_flash_str(*usart_rx_buffer); //usart_write_char(usart_rx_buffer); } /* #define uart_maxstrlen 64 volatile U8 uart_str_complete=0; volatile U8 uart_str_count=0; volatile U8 uart_string[uart_maxstrlen+1]=""; ISR(USART_RXC_vect) { unsigned char buffer = 64; // Daten aus dem Puffer lesen buffer = UDR; UDR = buffer; if ( uart_str_complete==0 ){ // wenn uart_string gerade in Verwendung, neues Zeichen verwerfen // Daten werden erst in string geschrieben, wenn nicht String-Ende/max Zeichenlänge erreicht ist/string gerade verarbeitet wird if (buffer!='\n' && buffer!='\r' && uart_str_count