串口打印 - TMS320C6748 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4324|回复: 3

[未解决] 串口打印

[复制链接]

40

主题

93

帖子

530

积分

高级会员

Rank: 4

积分
530
发表于 2019-4-22 15:35:50 | 显示全部楼层 |阅读模式
double xiangwei=3.1415926;double fuzhi=3.1415926;
UARTprintf("fuzhi:%f and xiangwei:%f\n",fuzhi,xiangwei);

如上所示的代码,我使用串口发送到串口调试助手上显示,为什么串口调试助手显示浮点数时会出现这种情况这是串口调试助手的显示问题还是串口本身的原因啊

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

3

主题

524

帖子

2083

积分

创龙

Rank: 8Rank: 8

积分
2083
发表于 2019-4-23 18:41:15 | 显示全部楼层
不支持浮点输出,要用sprintf转换成字符串再输出。
回复 支持 反对

使用道具 举报

1

主题

5

帖子

1034

积分

金牌会员

Rank: 6Rank: 6

积分
1034
发表于 2019-5-5 22:33:28 | 显示全部楼层
void UARTprintf (const char * pcString,
...
)

A simple UART based printf function supporting %c, %d, %p, %s, %u, %x, and %X.
Parameters
pcStringis the format string.
...are the optional arguments, which depend on the contents of the format string.
This function is very similar to the C library fprintf() function. All of its output will be sent to the UART. Only the following formatting characters are supported:
  • %c to print a character
  • %d to print a decimal value
  • %s to print a string
  • %u to print an unsigned decimal value
  • %x to print a hexadecimal value using lower case letters
  • %X to print a hexadecimal value using lower case letters (not upper case letters as would typically be used)
  • %p to print a pointer as a hexadecimal value
  • %% to print out a % character
For %s, %d, %u, %p, %x, and %X, an optional number may reside between the % and the format character, which specifies the minimum number of characters to use for that value; if preceded by a 0 then the extra characters will be filled with zeros instead of spaces. For example, \%8d'' will use eight characters to print the decimal value with spaces added to reach eight;%08d'' will use eight characters as well but will add zeroes instead of spaces.
The type of the arguments after pcString must match the requirements of the format string. For example, if an integer was passed where a string was expected, an error of some kind will most likely occur.
ReturnsNone.上面说的这个函数不是不能打印浮点型得嘛


回复 支持 反对

使用道具 举报

44

主题

63

帖子

1296

积分

金牌会员

Rank: 6Rank: 6

积分
1296
发表于 2020-12-9 21:11:04 | 显示全部楼层
您好,请问你这些函数的说明怎么查的?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2024-3-29 00:07 , Processed in 0.038870 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表