From 49dd5841857ace6d518ae2e047c1a043d3084620 Mon Sep 17 00:00:00 2001 From: jakegoodwin Date: Sat, 14 Jan 2023 13:26:11 -0800 Subject: [PATCH] wrote echoing main test --- avr_usart.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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<