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.

MSP430F5529: CCS无法使用sprintf的%f格式化

Part Number: MSP430F5529

CCS中无法使用sprintf将浮点型数据转化为字符串,但是能用%d,%s就是不能用%f。我用%f时,串口打印出来的只有f

已经将那个什么改为full,堆在上的heap也改了0x400

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
char d[100];
float a=5.123,b=10,c=20;
void FireWater_Test(void)
{
a+=10;
b+=10;
c+=10;
sprintf(d,"%.2f,%.2f%.2f\n",a,b,c);
OLED_ShowString(1,0,d,0);
send1_buf(d);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

oled显示2f,2f,2f

串口也显示同样的东西是什么原因呢