AnsweredAssumed Answered

Need Clarification on USART's in STM32f0

Question asked by spiritlingas on Jun 3, 2015
Latest reply on Jun 26, 2015 by spiritlingas
Hello,

                I working on USART in stm32f0-discovery board, in that USART keeps on sending a character 'c'..But i intended to write a code it sends the character 'c' whenever it receives 'a' ....Why it is happening like tat, my code is

void usart_access(void)
{
         
             unsigned char ab=USART_ReceiveData(USART2);
             if(ab == 'a')
             {
                  while (USART_GetFlagStatus(USART2, USART_FLAG_RXNE) == RESET);
                     USART_SendData(USART2,'c');
             }
            
}


The USART_access function called in the while(1) loop.

Outcomes