<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>CodeWarrior Development ToolsのトピックHow to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656162#M5795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;is the scenario:&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;crop from my codes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%f\n",ADC_PollRead(ADC,ADC_CHANNEL_AD12));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%f\n",12.18);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%.2f\n",c);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%.2f\n",result);&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;crop output from the hyperterminal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to fix this issue? Thank you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Nov 2016 11:57:11 GMT</pubDate>
    <dc:creator>eyeow84</dc:creator>
    <dc:date>2016-11-14T11:57:11Z</dc:date>
    <item>
      <title>How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656162#M5795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;is the scenario:&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;crop from my codes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%f\n",ADC_PollRead(ADC,ADC_CHANNEL_AD12));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%f\n",12.18);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%.2f\n",c);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;printf("Temperature sensor conversion value:%.2f\n",result);&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;crop output from the hyperterminal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Temperature sensor conversion value:f&lt;/EM&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to fix this issue? Thank you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2016 11:57:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656162#M5795</guid>
      <dc:creator>eyeow84</dc:creator>
      <dc:date>2016-11-14T11:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656163#M5796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Perhaps the issue is caused by the library settings in the project properties.&lt;/P&gt;&lt;P&gt;Go to:&lt;/P&gt;&lt;P&gt;Prj. Properties&lt;/P&gt;&lt;P&gt;C/C++ build -&amp;gt; Settings&lt;/P&gt;&lt;P&gt;Librarian&lt;/P&gt;&lt;P&gt;Tool Settings tab&lt;/P&gt;&lt;P&gt;See the library configuration listboxes in the window&lt;/P&gt;&lt;P&gt;Select the printf / scanf formats&lt;/P&gt;&lt;P&gt;By default it is "int"&lt;/P&gt;&lt;P&gt;Try to Change to FP or LL&lt;/P&gt;&lt;P&gt;Rebuild all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2016 12:58:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656163#M5796</guid>
      <dc:creator>michael_galda</dc:creator>
      <dc:date>2016-11-14T12:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656164#M5797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your advice. Unfortunately it doesn't work for my case. I have tried all the possible options under Print formats and Scan formats and the problem still persists...&lt;span class="lia-inline-image-display-wrapper" image-alt="screenshot.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/8559i3E1661164BEE6E2B/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot.jpg" alt="screenshot.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 01:15:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656164#M5797</guid>
      <dc:creator>eyeow84</dc:creator>
      <dc:date>2016-11-15T01:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656165#M5798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I just made a quick test from my side with CW10.7 and k60dn512 board, floating number can be printed well to terminal.&lt;/P&gt;&lt;P&gt;see my attached video and demo code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Jennie Zhang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 07:28:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656165#M5798</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2016-11-15T07:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656166#M5799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zhang,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply and a&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;ppreciate your shared example with demo clip. I think the error message attached should b expected as i don't have&amp;nbsp;&lt;SPAN&gt;k60dn512 with me right now, right?&lt;span class="lia-inline-image-display-wrapper" image-alt="error screen shot.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/9411iF67853868C0E7D8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="error screen shot.jpg" alt="error screen shot.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I am not sure what is missing right now? Or is it due to CW 10.6 configuration setting? Changing the l&lt;SPAN&gt;ibrary settings in the project properties seems like doesn't help for my case.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;The sample code is modified from&amp;nbsp;&lt;A href="https://community.nxp.com/docs/DOC-329476"&gt;FRDM-KEXX Driver Library Package&lt;/A&gt;. So far I had tried on three of those demo codes below like ADC_poll_demo, ADC_int_demo and ADC_FIFO_demo, the same problem persists when I am trying to use printf(%f) function at console.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;Appreciate if there is any other advice...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 06:31:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656166#M5799</guid>
      <dc:creator>eyeow84</dc:creator>
      <dc:date>2016-11-21T06:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656167#M5800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am reading this again.&lt;/P&gt;&lt;P&gt;Now, it is a bit clearer for me, that you want to use "printf" function for writing to the console / terminal.&lt;/P&gt;&lt;P&gt;As you are normally using the same for the PC programs.&lt;/P&gt;&lt;P&gt;But I think, that the printf implemented / used&amp;nbsp;in CW10.6 doesn't&amp;nbsp;convert float numbers to characters.&lt;/P&gt;&lt;P&gt;My recommended workaround is:&lt;/P&gt;&lt;P&gt;1. Use "sprintf" function at first to format the strings at first. This should work in all cases&lt;/P&gt;&lt;P&gt;2. Then use "printf" for printing this created string.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 09:36:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656167#M5800</guid>
      <dc:creator>michael_galda</dc:creator>
      <dc:date>2016-11-21T09:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix printf(%f) issue in CW 10.6 with MCU MKE06Z ?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656168#M5801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your suggestion to use sprintf. I think it should be working fine for my case, that i need to put in extra lines of code to output floating point at hyperterminal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;crop from my codes:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;char str[100];&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; float cal&amp;nbsp;= 12.345678;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;int d1 = cal; // Get the integer part&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; float f2 = cal - d1; // Get fractional part&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; int d2 = trunc(f2*10000); // Turn into integer&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; float f3 = f2*10000 - d2; // Get next fractional part&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; int d3 = trunc(f3*10000); // Turn into integer&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; printf("d1:%d\n",d1);&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; printf("d2:%d\n",d2);&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; printf("d3:%d\n",d3); &lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; sprintf(str, "calA = %d.%04d%04d\n",d1,d2,d3);&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; puts(str);&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt; printf("cal float:%f\n",cal);&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;crop output from the hyperterminal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;d1:12&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;d2:3456&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;d3:7832&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;calA = 12.34567832&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;EM&gt;cal float:f&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can conclude that actually float is still recognized, just that printf(%f) is not recognized and always show value f as output. Of course welcome if any of you manage to advice the most appropriate method to enable printf(%f) function in CW 10.6 with MCU MKE06Z&amp;nbsp;it would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2016 02:47:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-fix-printf-f-issue-in-CW-10-6-with-MCU-MKE06Z/m-p/656168#M5801</guid>
      <dc:creator>eyeow84</dc:creator>
      <dc:date>2016-11-24T02:47:43Z</dc:date>
    </item>
  </channel>
</rss>

