用microchip studio 开发C21J18A,printf发不出%f数据,怎么解决?

[复制链接]
8068|10
 楼主| jack45 发表于 2023-5-10 11:01 | 显示全部楼层 |阅读模式
float test = 3.141592;
printf("ref = %d",test);

串口工具上发出的是:
[09:53:24.356]收←◆ref =

printf发不出%f数据,怎么解决?
Pohlen 发表于 2023-5-10 23:15 | 显示全部楼层

用microchip studio 开发C21J18A,printf发不出%f数据,怎么解决?

抄个函数,把float类型转换为string? _(:Ⅰ」∠)_ 我猜
ccd007 发表于 2023-5-11 08:25 | 显示全部楼层
printf("ref = %d",test);  ????   printf("ref = %f",test);
zlzilla 发表于 2023-5-11 09:04 | 显示全部楼层
printf太古老了,建议用新的Harmony3 SDK库的Console Debug System,比printf多了异步发送和打印等级控制,还能做命令行的输入。

https://github.com/Microchip-MPLAB-Harmony/core_apps_sam_c20_c21/tree/master/apps/system/console_debug/sys_console_debug_uart_read_write
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

2

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部