cancel
Showing results for 
Search instead for 
Did you mean: 

Need Clarification on USART's in STM32f0

LRPS_92
Associate II
Posted on June 03, 2015 at 09:16

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.

#stm32f0-usart
2 REPLIES 2
Posted on June 03, 2015 at 15:21

Wait for RXNE before receiving the character, and TXE before sending the response.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LRPS_92
Associate II
Posted on June 26, 2015 at 15:10

Thanks for your help clive!!.