//Create USART options struct
static usart_rs232_options_t USART_SERIAL_OPTIONS = {
.baudrate = USART_SERIAL_BAUDRATE,
.charlength = USART_SERIAL_CHAR_LENGTH,
.paritytype = USART_SERIAL_PARITY,
.stopbits = USART_SERIAL_STOP_BIT
};
sysclk_enable_module(SYSCLK_PORT_E, PR_USART0_bm);//Enable the clock for the USART module
usart_init_rs232(&USARTE0, &USART_SERIAL_OPTIONS);//Initialize in RS232 mode:
uint8_t received_byte;//A variable for the received byte must be added:
while(1)
{
received_byte = usart_getchar(&USARTE0);//Wait for reception of a character:
usart_putchar(&USARTE0, received_byte);//Echo the character back: