PIC16F系列MCU用printf函数调试程序时能否打印浮点类型,如果能需要怎样配置?
例如 printf("a = %f\r\n",a); a是浮点型,当是%f编译就会出错,改为%d就能正常编译,
报错信息::0:: error: (1347) can't find 0x22F words (0x22f withtotal) for psect "text20" in class "CODE" (largest unused contiguous range 0x208)
Non line specific message::: advisory: (1493) updated 32-bit floating-point routines might trigger "can't find space" messages appearing after updating to this release; consider using the smaller 24-bit floating-point types
更多操作 评论编辑回复
#include <math.h>
#include <stdio.h>
/* Print acos() values for -1 to 1 in degrees. */
void
main (void)
{
float i, a;
for(i = -1.0; i < 1.0 ; i += 0.1)
{
a = acos(i)*180.0/3.141592;
printf(“acos(%f) = %f degrees\n”, i, a);
}
}
参考这个例子看看?
#include <math.h>
#include <stdio.h>
/* Print acos() values for -1 to 1 in degrees. */
void
main (void)
{
float i, a;
for(i = -1.0; i < 1.0 ; i += 0.1)
{
a = acos(i)*180.0/3.141592;
printf(“acos(%f) = %f degrees\n”, i, a);
}
}
参考这个例子看看?