<?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 for MCUのトピックRe: Replace sprintf</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136384#M1848</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Seriously... 1600 bytes for ASCII to int convertion...&lt;BR /&gt;It is maybe acceptable in some hobby project. Maybe.&lt;BR /&gt;&lt;BR /&gt;A snippet doing that converstion would take around 100 bytes, depending on how code-effective the mcu is.&lt;BR /&gt;I could post the code for one, but if you don't know how to write it yourself... well...&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 May 2006 19:54:52 GMT</pubDate>
    <dc:creator>Lundin</dc:creator>
    <dc:date>2006-05-19T19:54:52Z</dc:date>
    <item>
      <title>Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136379#M1843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in my application (I'm using CW3.0 for HC08) I would like to convert int variable into string, to output it on display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So I placed sprintf function, like that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;int int_var;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;char lcd_buffer[86];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sprintf(lcd_buffer,"value is: %i",int_var)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It worked fine, of course, but sprintf function occupied about 6kbytes of flash memory (!!!). Is there a way to shrink it? Or some other function to convert int to string? I know, that sprintf is able to convert float, but it's useless for me, just eating expensive flash memory (I need to convert just integer numbers, like int or char).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jarin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 04:46:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136379#M1843</guid>
      <dc:creator>jarin</dc:creator>
      <dc:date>2006-05-18T04:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136380#M1844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This is one of the reasons why it isn't wise to use sprintf() in embedded/real time applications. My advice is to avoid all library functions and write your own versions of them.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 19:58:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136380#M1844</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-05-18T19:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136381#M1845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Lundin, I know, it's better to write my own functions to handle this... but I hope somebody have also those function public, to inspire me &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 20:48:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136381#M1845</guid>
      <dc:creator>jarin</dc:creator>
      <dc:date>2006-05-18T20:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136382#M1846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Are you intending to use floating point variables in printf?&lt;BR /&gt;You should be able to get a smaller footprint for that function if you are not using floating point.&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Upgrading to a later version of CodeWarrior (V3.1 or later)), we have new library files used when floating point arithmetic is used in&amp;nbsp;the application (ansii.lib instead of ansi.lib) for instance.&lt;/P&gt;&lt;P&gt;Footprint for sprintf is much smaller there (around 1600 bytes if I remember well).&lt;BR /&gt;If you want to stick with V3.0 &amp;nbsp;you may have to regenerate the desired ANSI library specifying you do not want to use floating point arithmetic in sprintf.&lt;/P&gt;&lt;P&gt;Take a look at the attached technical note for information on how to regenerate library files.&lt;/P&gt;&lt;P&gt;You have to&amp;nbsp;set &amp;nbsp;LIBDEF_PRINTF_FLOATING to 0 in libdefs.h and rebuild the library (or at least rebuild printf.c).&lt;/P&gt;&lt;P&gt;If you have a special edition I think you will not be able to rebuild the whole library. You will then have to rebuild printf only&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2006 00:26:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136382#M1846</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-05-19T00:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136383#M1847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;CrasyCat:&lt;BR /&gt;Yes, it looks very good. I complained about size of sprintf function, because I don't need floating point suuport in it.&lt;BR /&gt;I'll try it, because 1,6KB is much better compared to about 6KB, thank you very much or your help.&lt;BR /&gt;&lt;BR /&gt;Jarin&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2006 02:46:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136383#M1847</guid>
      <dc:creator>jarin</dc:creator>
      <dc:date>2006-05-19T02:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136384#M1848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Seriously... 1600 bytes for ASCII to int convertion...&lt;BR /&gt;It is maybe acceptable in some hobby project. Maybe.&lt;BR /&gt;&lt;BR /&gt;A snippet doing that converstion would take around 100 bytes, depending on how code-effective the mcu is.&lt;BR /&gt;I could post the code for one, but if you don't know how to write it yourself... well...&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 May 2006 19:54:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136384#M1848</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-05-19T19:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replace sprintf</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136385#M1849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Well printf is not just converting an int to a string. It is doing much more that this (specifically in formatting the output string).&lt;/P&gt;&lt;P&gt;The size specified is the size of the function sprintf which does not support floating point conversion.&lt;/P&gt;&lt;P&gt;For sure if you just need to convert a int to a string, you can get a smaller footprint.&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2006 17:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Replace-sprintf/m-p/136385#M1849</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-05-22T17:22:03Z</dc:date>
    </item>
  </channel>
</rss>

