<?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>Kinetis MicrocontrollersのトピックRe: sprintf</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190525#M2204</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Has this situation improved yet for CW10.2 and processor expert? &amp;nbsp;This seems like a capability that should be there for such a powerful processor as the Kinetis, or at least an option to include a special library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need to be able to printf and sprintf float quantities without having to totally rewrite code that was probably written 30 years ago.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 22:04:24 GMT</pubDate>
    <dc:creator>SDame</dc:creator>
    <dc:date>2012-04-04T22:04:24Z</dc:date>
    <item>
      <title>sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190521#M2200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I have a quick (and probably dumb) question on sprintf for the kinetis MCU. &amp;nbsp;I am trying to use sprintf on a floating point number and have had trouble (yes I realize sprintf is huge when used on floats). &amp;nbsp;It works fine with integers but not floats. &amp;nbsp;What is the trick to get it to work? Here is an example of how I am formatting the string:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;float test = 10.123;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;sprintf(tempString, "%2.1f", test);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;When I have used sprintf with other MCU's (microchip) this would spit out "10.1" to my display. This prints out "%2.1f" when I use it with CodeWarrior / kinetis. &amp;nbsp;What am I missing? &amp;nbsp;I am using CodeWarrior 10.1 with all the latest updates/patches. &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2011 23:18:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190521#M2200</guid>
      <dc:creator>Klayton</dc:creator>
      <dc:date>2011-12-15T23:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190522#M2201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using the code that comes with the Kinetis example projects?&amp;nbsp; These contain custom printf and sprintf implementations in printf.c that does not include floating-point print support.&amp;nbsp; To print floating points you will need to use a c standard library that has been compiled with floating point enabled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Dec 2011 06:02:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190522#M2201</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2011-12-16T06:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190523#M2202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not using any code from an example project. &amp;nbsp;The stdio.h header file i am including is in the ARM_EABI_Support\ewl\EWL_C\include directory. &amp;nbsp;I have no idea how to enable float for this header. &amp;nbsp;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Dec 2011 21:19:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190523#M2202</guid>
      <dc:creator>Klayton</dc:creator>
      <dc:date>2011-12-16T21:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190524#M2203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, you can't enable floating point support with a few #defines in a header file.&amp;nbsp; Most printf implementations for embedded processors don't include floating point support in the c library to keep the size of the library down.&amp;nbsp; Printf is usually found in libc.a (the standard c library) for a c compiler, and you're going to have to recompile that library to enable floating point support.&amp;nbsp; The other option is to provide your own custom printf routine that implements floating point.&amp;nbsp; Check out newlib for an example, but I'll warn you ahead of time that you'll also need a working implementation of malloc and free if you want to use that one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 10:36:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190524#M2203</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2011-12-19T10:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190525#M2204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Has this situation improved yet for CW10.2 and processor expert? &amp;nbsp;This seems like a capability that should be there for such a powerful processor as the Kinetis, or at least an option to include a special library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need to be able to printf and sprintf float quantities without having to totally rewrite code that was probably written 30 years ago.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 22:04:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190525#M2204</guid>
      <dc:creator>SDame</dc:creator>
      <dc:date>2012-04-04T22:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190526#M2205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There is an definition:&lt;/P&gt;&lt;P align="left"&gt;/*&lt;/P&gt;&lt;P align="left"&gt;** When MQX_INCLUDE_FLOATING_POINT_IO is defined as 1,&lt;/P&gt;&lt;P align="left"&gt;** _io_printf and _io_scanf will include floating point I/O code.&lt;/P&gt;&lt;P align="left"&gt;*/&lt;/P&gt;&lt;P align="left"&gt;#ifndef&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;MQX_INCLUDE_FLOATING_POINT_IO&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;#define&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;MQX_INCLUDE_FLOATING_POINT_IO 0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;#endif&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;Set this to one in user_config.h.&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;But this eats lot of stack, in io_dopr.c:_io_doprint():&lt;/P&gt;&lt;P align="left"&gt;#if&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;MQX_INCLUDE_FLOATING_POINT_IO&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG&gt;&lt;FONT color="#7F0055" size="2"&gt;&lt;FONT color="#7F0055" size="2"&gt;char&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;prec_set;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG&gt;&lt;FONT color="#7F0055" size="2"&gt;&lt;FONT color="#7F0055" size="2"&gt;double&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2"&gt;&lt;FONT size="2"&gt;fnumber;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;STRONG&gt;&lt;FONT color="#7F0055" size="2"&gt;&lt;FONT color="#7F0055" size="2"&gt;char&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT size="2"&gt;fstring[324];&lt;/FONT&gt; &lt;FONT color="#3F7F5F" size="2"&gt;&lt;FONT color="#3F7F5F" size="2"&gt;/* Floating point output string */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;#endif&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;~Mark&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 14:57:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190526#M2205</guid>
      <dc:creator>MarkP_</dc:creator>
      <dc:date>2012-04-05T14:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190527#M2206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the same problem, but I'm not using MQX, I'm using Processor Expert...&lt;BR /&gt;Someone could figure out how to use sprintf with float in processor expert??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 15:22:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190527#M2206</guid>
      <dc:creator>alfredogualdron</dc:creator>
      <dc:date>2013-09-13T15:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190528#M2207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here I have a modified printf.c code, it was modified from KL25' demo code, and can printf &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;floating point number&lt;/SPAN&gt; in 6 bit precision, also you can change it by adjusting the parameter-precision=n. !&lt;/P&gt;&lt;P&gt;Wish it can help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Sep 2013 05:21:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190528#M2207</guid>
      <dc:creator>ConstYu</dc:creator>
      <dc:date>2013-09-17T05:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190529#M2208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved the issue and I posted Here&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/44262"&gt;sprintf problem in MCF51QE128 and Codewarrior.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;hope it helps&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 23:26:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/sprintf/m-p/190529#M2208</guid>
      <dc:creator>alfredogualdron</dc:creator>
      <dc:date>2014-02-04T23:26:22Z</dc:date>
    </item>
  </channel>
</rss>

