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.

[参考译文] 编译器/MSP430F5659:为 TI grlib 抽字符串函数将浮点数字转换为字符串

Guru**** 2538950 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/750190/compiler-msp430f5659-converting-floating-point-numbers-to-strings-for-ti-grlib-drawstring-functions

器件型号:MSP430F5659

工具/软件:TI C/C++编译器

您好!

我有一组传感器连接到 MSP430的 A/D 输入端。 将数据转换为浮点变量后、我需要将值转换为 grlib 抽取字符串函数的字符串。 我的问题是、我应该编写自己的例程来执行此操作、还是有一些内置函数、例如 printf、我可以使用的部分  功能来完成此操作?  

谢谢、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    如果启用了 full-printf 功能,则 sprintf ()应该起作用。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    非常感谢 Keith!!!当我把最小值更改成了满值时,它就能工作了。

    字符结果[10];
    float testf=44.61;
    sprintf (结果、"%f"、testf);

    graphics_drawStringCenter(&g_sContext,&result,5,...