Simple Printf on CF question

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Simple Printf on CF question

4,655 次查看
dvona
Contributor II

I'm trying to do a simple print of a floating point number out of a UART, and cannot figure out why I can’t seem to use a printf statement to display floating point values? For example

printf("\ntest printf with float = %5.2f", 1.23456);

results in just the letter “f” printed from hyperterminal: test printf with float = f.

Is there something I need to do because I am not on a floating point machine to enable printf to print floats?

 

标签 (1)
0 项奖励
回复
2 回复数

1,157 次查看
nanoGeek
Contributor I
Make sure your project is not using a simpler version of printf (printD and/or printk).  One of the projects I have imported in the past (dbug for CF) uses printD which calls printk (which has no floating point support) with a #define printf printD.
 
0 项奖励
回复

1,157 次查看
CrasyCat
Specialist III
Hello
 
 It works for me.
 
 Which version of Codefire tools are you using (V6.2, ...)?
 Did you include the file stdio.h at the beginning of the source file?
 
 Which runtime libraries are you linking to your application?
 For which CPU are you generating code (MCF5282, ...)?
 
CrasyCat
0 项奖励
回复