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.

sprintf 与 中断



由于starterware的UARTprintf()函数不能输出浮点数,所以试图构建函数来打印输出浮点数。

构建的函数如下:

void UARTprintfF32(F32 var)
{
    static S8 str[50];

    memset(str, '\0', sizeof(str));
    sprintf(str, "%f", var);
    UARTprintf("%s\n",str);
}

在未有中断时,该函数打印输出是正确的,但是中断开启后,打印输出出错了。

希望有朋友给予帮助,谢谢