Skip to main content
pedroh44
Visitor II
March 20, 2014
Question

Problem sending with USART_SendData

  • March 20, 2014
  • 1 reply
  • 568 views
Posted on March 20, 2014 at 16:25

USART_SendData(USART1, 12);
USART_SendData(USART1, v_dc_int);
USART_SendData(USART1, v_dc_fra);

If I send only one of the it is received fine. But if I send them all, I only can see the last of them. Do I have to do something between each byte sent to make sure it is received well? Like to wait for the register to be empty? If so, how do I do that?
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    March 20, 2014
    Posted on March 20, 2014 at 16:38

    Yes, like pretty much every USART ever, you have to check if it can take the byte you want to send.

    while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); // Wait for Empty
    USART_SendData(USART1, 0x49); // Send 'I'

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..