Hi,
I have a "frame" of about 52 bytes that I am sending into the USART Rx pin. I would like to read this in and load the data into an array that I could later grab from. Using USARTC0.DATA, how would I load the "frame" into an array this size?
Hi,
I have a "frame" of about 52 bytes that I am sending into the USART Rx pin. I would like to read this in and load the data into an array that I could later grab from. Using USARTC0.DATA, how would I load the "frame" into an array this size?
char frame[52]; for (i = 0; i < 52; i++) { while (~USARTC0.STATUS & USART_RXCIF_bm); frame[i] = USARTC0.DATA; }
You can also do this using a FIFO buffer that is found in ASF.
ISR(USARTC0_RXC_vect){ switch(fifo_push_uint8_t(&fifo_rx_buffer, USARTC0.DATA)){ case FIFO_OK: //Do something or not break; case FIFO_ERROR_OVERFLOW: //Do something or not break; } }