<?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>topic Re: MK22F printf floating point numbers in KDS in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962183#M55040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mi,&lt;/P&gt;&lt;P&gt;see &lt;A class="link-titled" href="https://mcuoneclipse.com/2015/04/23/semihosting-with-gnu-arm-embedded-launchpad-and-kinetis-design-studio/" title="https://mcuoneclipse.com/2015/04/23/semihosting-with-gnu-arm-embedded-launchpad-and-kinetis-design-studio/"&gt;Semihosting with GNU ARM Embedded (Launchpad) and Kinetis Design Studio | MCU on Eclipse&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Section&lt;/P&gt;&lt;H1&gt;Printf() and Scanf() with Floating Point&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2019 06:09:21 GMT</pubDate>
    <dc:creator>ErichStyger</dc:creator>
    <dc:date>2019-10-10T06:09:21Z</dc:date>
    <item>
      <title>MK22F printf floating point numbers in KDS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962182#M55039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a 2-year old custom board that was developed with Kinetis K22FX512 MCU.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing code re-engineering and maintenance of its firmware inside Kinetis Design Studio IDE for 1.5 years to add new features as requested for the product's enhancements and upgrades.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All these years, all the numeric data are integers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am required to change of the16-bit&amp;nbsp;integer data to floating point, e.g. instead of 999 seconds, I'm converting to 99.9 minutes.&amp;nbsp; This way, timer can go above 16+ minutes in 16-bit as well as for limit 3-character display that can only show 3 digit positions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before altering anything about this data, I had to first try defining, declaring and printing a floating point variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I searched previous posts on this forum about "PRINTF_FLOAT_ENABLE" and such.&amp;nbsp;&amp;nbsp; I found about 3 threads from 2015 about the matter and tried them all out, changing "settings" in project's property in compiler and linker sections.&amp;nbsp; However, none of them works.&amp;nbsp;&amp;nbsp; I get the same result as those posts reported, whereby only "f" is printed in place of the %f in the printf() function.&amp;nbsp; I even #included &amp;lt;float.h&amp;gt; standard C library but still the same problem.&amp;nbsp; Only character "f" prints on the debug console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone else know how to fix this problem for this MCU in KDS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2019 21:44:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962182#M55039</guid>
      <dc:creator>mci</dc:creator>
      <dc:date>2019-10-09T21:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: MK22F printf floating point numbers in KDS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962183#M55040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mi,&lt;/P&gt;&lt;P&gt;see &lt;A class="link-titled" href="https://mcuoneclipse.com/2015/04/23/semihosting-with-gnu-arm-embedded-launchpad-and-kinetis-design-studio/" title="https://mcuoneclipse.com/2015/04/23/semihosting-with-gnu-arm-embedded-launchpad-and-kinetis-design-studio/"&gt;Semihosting with GNU ARM Embedded (Launchpad) and Kinetis Design Studio | MCU on Eclipse&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Section&lt;/P&gt;&lt;H1&gt;Printf() and Scanf() with Floating Point&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 06:09:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962183#M55040</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2019-10-10T06:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: MK22F printf floating point numbers in KDS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962184#M55041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;but KDS can print float format well. Please see the attachment.&lt;/P&gt;&lt;P&gt;&lt;A class="" href="http://www.itkeyword.com/doc/7890215869147939x765/c-snprintf-prints-garbage-floats-with-newlib-nano" title="http://www.itkeyword.com/doc/7890215869147939x765/c-snprintf-prints-garbage-floats-with-newlib-nano"&gt;解决c - snprintf() prints garbage floats with newlib nano - printf-arm-embedded - ITkeyowrd&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 11.0pt; "&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/497912"&gt;https://community.nxp.com/thread/497912&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 11.0pt; "&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-size: 11.0pt; "&gt;Jing&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 07:48:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962184#M55041</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2019-10-10T07:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: MK22F printf floating point numbers in KDS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962185#M55042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich and Jing,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your instructions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I apologize if I was not clear, but I am using a&amp;nbsp;USB - FTDI UART&amp;nbsp;protocol connected terminal emulator console outside of KDS (and MCUXpresso on the other project).&amp;nbsp;&amp;nbsp; I'm not using the "Console" tab inside KDS.&amp;nbsp;&amp;nbsp;&amp;nbsp; I see message dumps there for builds, erase, programming and debug start but I dump all printf's out through UART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found one of old posts that is what I tried yesterday &amp;amp; it works by basically separating the whole number part from the decimal place part of the floating point number, and then concatenating them together as a "string" by sprint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that's what I'll be implementing here onwards.&amp;nbsp;&amp;nbsp; Afterall, this display is only for debugging purposes.&amp;nbsp;&amp;nbsp; I know internally in the float variable, the format is a float and all math computations work normal on the float.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may refer to this link where I found this method:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/438758"&gt;https://community.nxp.com/thread/438758&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any further comments or suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for the help,&lt;/P&gt;&lt;P&gt;MI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:38:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962185#M55042</guid>
      <dc:creator>mci</dc:creator>
      <dc:date>2019-10-10T15:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: MK22F printf floating point numbers in KDS</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962186#M55043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What library are you using?&lt;/P&gt;&lt;P&gt;E.g. for newllib nano there is a dedicated option for this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/91222iD680F6D7EA37165F/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2019 19:36:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/MK22F-printf-floating-point-numbers-in-KDS/m-p/962186#M55043</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2019-10-10T19:36:21Z</dc:date>
    </item>
  </channel>
</rss>

