关于msp430 launchpad 中sprintf的使用

2019-03-24 09:38发布

#include"msp430g2553.h"
#include"lcd12864.h"
#include"stdio.h" //用sprintf要用的头文件
#include"math.h"
#define uint unsigned int
#define uchar unsigned char

uchar display[16];
volatile float temp = 4.55f;
//const uchar table_hz[] ={"电压 :"};
void main(void)
{
      WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗
      Ini_Lcd();

      sprintf(display, "%4.2f", 3.1415);
      Disp_HZ(0, display);
      LPM4;
}
为什么显示的内容为             .2f不是3.14?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
12条回答
Asure1008
2019-03-25 22:08
armcu 发表于 2014-8-8 13:22
其实IAR也挺好的,实在不行换成IAR吧

以前帮别人写过K60的程序的时候用过IAR,用的还习惯的

一周热门 更多>

相关问题

    相关文章