diff --git a/avr_usart.c b/avr_usart.c index a934434..2dbcd84 100644 --- a/avr_usart.c +++ b/avr_usart.c @@ -32,16 +32,18 @@ int main() { uint8_t buf_len = 12; //unsigned char data[12] = "snd 12chars\0"; //unsigned char data[1] = "A"; - unsigned char data = '0'; + unsigned char data[1] = "B"; while(1) { //serial0_write(data, buf_len); - tx_usart0(data); + if(data[0] == 0) { + data[0] = '!'; + } + tx_usart0(data[0]); //serial0_read(data, buf_len); //data = rx_usart0(); serial0_flush_rxbuf(); - serial0_read(data, 1); - //led_blink(); + serial0_read_with_err_checking(data, 1); } return 0; @@ -77,7 +79,8 @@ void init_usart0(void) { //setting the data frame format //We leave the 2MSB zero for async serial. And we also don't enable //parity bits for now. We set a 2bit stop bit and 8bit char size. - UCSR0C = (1<