Hello, in the code bellow i see the use of USART register .
Why do we need USART1->IEN = USART_IEN_RXDATAV; and NVIC_EnableIRQ(USART1_RX_IRQn);
An interupt is a simething that stops the general code to execute another code.
I cant see it here.
I cant see how the operations in the code bellow are interupts?
Why do we need USART1->IEN = USART_IEN_RXDATAV; and NVIC_EnableIRQ(USART1_RX_IRQn);
An interupt is a simething that stops the general code to execute another code.
I cant see it here.
I cant see how the operations in the code bellow are interupts?
Code:
void USART1_RX_IRQHandler(void)
{
if(USART1->STATUS & (1 << 7)) { // if RX buffer contains valid data
rx_char = USART1->RXDATA; // store the data
}
if(rx_char) { // if we have a valid character
if(USART1->STATUS & (1 << 6)) { // check if TX buffer is empty
USART1->TXDATA = rx_char; // echo received char
rx_char = 0; // reset temp variable
}
}
}