This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-F28379D: Send a float to SCI UART

Expert 1985 points
Part Number: LAUNCHXL-F28379D


Tool/software: Code Composer Studio

Hello,

I need to send float data to SCI_UART. Based on SCI examples basic code for sending character is:

char *msg;
//......
msg = "\r\n\n\nHello World!\0";
scia_msg(msg);
//......
//
// scia_xmit - Transmit a character from the SCI
//
void scia_xmit(int a)
{
    while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
    SciaRegs.SCITXBUF.all =a;
}

//
// scia_msg - Transmit message via SCIA
//
void scia_msg(char * msg)
{
    int i;
    i = 0;
    while(msg[i] != '\0')
    {
        scia_xmit(msg[i]);
        i++;
    }
}

And I can receive this message in the RX.

But when I try to send a char like this: 

float f;
//.....
sprintf(msg, "%f\0", f);
scia_msg(msg);

This message will not be sent to the RX.

Thanks for your help.

Regards,

Amin