AnsweredAssumed Answered

How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?

Question asked by Eyeow Lee on Nov 14, 2016
Latest reply on Nov 23, 2016 by Eyeow Lee

Hello,

 

I am kinda beginner for CW 10.6 and C programming. My target mcu is MKE06Z128VLK4 on FRDM-KE06Z. I found there is a problem when i want to use the printf(%f) to show the temperature reading in 2 decimal points. Here is the scenario: 

 

crop from my codes:

printf("Temperature sensor conversion value:%f\n",ADC_PollRead(ADC,ADC_CHANNEL_AD12));

printf("Temperature sensor conversion value:%f\n",12.18);

printf("Temperature sensor conversion value:%.2f\n",c);

printf("Temperature sensor conversion value:%.2f\n",result); 

 

crop output from the hyperterminal:

Temperature sensor conversion value:f
Temperature sensor conversion value:f
Temperature sensor conversion value:f
Temperature sensor conversion value:f

 

I had read through some posts from the community and other tutorials. Is it due to some common library like stdio.h or float.h doesn't get installed/populated in CW? Thus printf(%f) is not recognized correctly in this environment?

 

How to fix this issue? Thank you in advance!

Outcomes