Cypress技术william hill官网
直播中

毛雅清

7年用户 150经验值
私信 关注
[问答]

如何将浮点转换成PSOC5上的字符串?

缺氧缺血性脑病,
有没有人知道如何将浮点转换成PSOC5(GCC编译器)上的字符串?我想把浮点转换成字符串,这样我就可以在我的GLCD上显示,它具有只显示字符串类型的库函数。

以上来自于百度翻译


     以下为原文
  Hie,
    Does anyone know how I can convert a float into a string on the psoc5 (gcc compiler)? I would like to convert floats into strings so that I can display on my GLCD which has library functions for displaying only string types.

回帖(2)

毛雅清

2019-3-28 07:00:58
我刚刚发现,Simulff()函数完全适用于这种转换。语法是这样的:
浮动A=4.8375;
查尔文本〔9〕;
SaveTFF(AX文本,“%F”,A);
A-文字〔4〕=‘0’;
这将返回字符串4.84

以上来自于百度翻译


     以下为原文
  I just discovered that the sprintf() function works perfectly for this conversion. The syntax is something like this:
    float a = 4.8375;
    char a_text[9];
    sprintf(a_text,"%f",a);
    a_text[4] = '';
     
    this will return the string 4.84
举报

马昱

2019-3-28 07:11:39
嗨,自由!
谢谢大家在william hill官网 上分享!

以上来自于百度翻译


     以下为原文
  Hi Liberty,
     
    Thank you for sharing this on the forum !
举报

更多回帖

发帖
×
20
完善资料,
赚取积分