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.

FG4618字符串转换

Other Parts Discussed in Thread: MSP430FG4618

在标准c的stdio.h中是提供sprintf()的,我将它用来进行字符转换,但是其在进行int型到char*转换是可以,而在long int型及float/double型转换为char*型时则不能正常进行。代码如下

#include<msp430.h>

#include<stdio.h>

void main(void)

{

      char str[20];

       float number = 1.2345;

 

       WDTCTL = WDTPW + WDTHOLD;

       sprintf(str,"%f",number);

        Printf(0,0,str);                                           // 这是自己写的液晶驱动程序中的函数,用于在0,0点显示字符串

        LPM0;

}

 请问在430中,是不支持long和float型到字符串的转换,还是调用的方法不对。求指教啊。

PS:我使用的是CCS V5.1,windows32位,第三方MSP430FG4618开发板。