<?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: Unsigned long int to ASCII conversion  - failed</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195024#M7166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like the solution has been found!&lt;/P&gt;&lt;P&gt;I've followed &lt;EM&gt;&lt;STRONG&gt;ComplierGuru&lt;/STRONG&gt;&lt;/EM&gt; suggestion and I've changed Stack size in Project.prm from 0x80 to 0x100 and now it works perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wondering why old stack size wasn't enough. I don't use interrupts and any complicated calculations aren't performed in my project...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for advise! Another usefull lesson....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2011 06:07:43 GMT</pubDate>
    <dc:creator>gooral</dc:creator>
    <dc:date>2011-03-31T06:07:43Z</dc:date>
    <item>
      <title>Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195015#M7157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm playing with small project based on JM60 and developed in CW 10.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rough description:&lt;/P&gt;&lt;P&gt;uC reads four 8-bit registers from peripherial (HCTL-2032 Quadrature-decoder/counter) connected to rotary encoder and display result on LCD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To this point everything works fine. I can observe register contetnt on LCD&amp;nbsp; in four groups eg. 255-255-255-255 (B4-B3-B2-B1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I'm trying to convert this 8-bit groups to unsigned long int (eg 0xFF FF FF FF) and then to ASCII using :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unsigned long int result_unsigned_int;&lt;/P&gt;&lt;P&gt;char out_ASCII[11];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;result_unsigned_int=(BYTE4*0x1000000)+(BYTE3*0x10000)+(BYTE2*0x100)+BYTE1;&lt;/P&gt;&lt;P&gt;sprintf(out, "%lu", result);&lt;/P&gt;&lt;P&gt;WriteStringToLCD(out);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works in ordinary c complier on PC but it doesn't in CW - something stucks nothing happens&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you tell me why? (Is there some restricions in sprintf in CW)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS&lt;/P&gt;&lt;P&gt;Of&amp;nbsp; course I use same WriteStringToLCD() to display other inforation and it works fine....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 01:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195015#M7157</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-03-30T01:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195016#M7158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are&amp;nbsp; you sure that you are passing the right variable,&amp;nbsp;&amp;nbsp; Result is not defined&amp;nbsp; - - above and does not contain the result of the putting of the 4 bytes together - - - - FYI, I tend to define a union&amp;nbsp; and then place the bytes directly - - faster code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 04:58:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195016#M7158</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-03-30T04:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195017#M7159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have right, but this is only my mistake in listing - of course should be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;result_unsigned_int=(BYTE4*0x1000000)+(BYTE3*0x10000)+(BYTE2*0x100)+BYTE1;&lt;/P&gt;&lt;P&gt;sprintf(out, "%lu", &lt;STRONG&gt;result_unsigned_int&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also try to simulate in CW and it works fine - out gets correct values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to debug via BDM - I set breakpoint after sprintf and - variable result_unsigned_int has correct value but out doesn't change (has its initial value). When debugger starts process sprints it stuck......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code obviously isn't optimal I know that&amp;nbsp;&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;/P&gt;&lt;P&gt;Bytes in union..., I'll try to implement this......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like itoa() for unsigned long int would be usefull (I'm using _itoa to convert decoder register values to ascii before displaing on LCD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 05:46:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195017#M7159</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-03-30T05:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195018#M7160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Out is not defined, I assume same mistake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am old hat type of programmer before standard lib's came about - - - - I have never liked the overhead of the printf, format, or sprintf - - - -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a routine that takes a nibble and outputs the hex code&lt;/P&gt;&lt;P&gt;this is called by the rountine to output a byte (twice)&lt;/P&gt;&lt;P&gt;the byte routine is called twice by the routine that outputs a 16 bit&amp;nbsp; - - - etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;routines are called out_nibble, out_byte, out_int - - and of course can simply add out_long&lt;/P&gt;&lt;P&gt;and in my case output directly to the serial output ring buffer for being sent out over a RS232 link to the program on the PC for debug and check out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Out_byte does a left shift for the top bits.&lt;/P&gt;&lt;P&gt;Out_Int has the value passed as a union so it simply calls Out_byte with upper and then lower byte.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus do not have to fight the lib functions - - - and get the data sent where I want it to be faster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 05:59:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195018#M7160</guid>
      <dc:creator>Jim_P</dc:creator>
      <dc:date>2011-03-30T05:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195019#M7161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;gooral,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are BYTE_X variables long integers? If not, then&amp;nbsp;result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;result_unsigned_int=(BYTE4*0x1000000)+(BYTE3*0x100​00)+(BYTE2*0x100)+BYTE1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^^&amp;nbsp;is always not higher&amp;nbsp;than 0xFFFF on C target machines with 16-bits int's. You need to convert at least BYTE_4 and BYTE_3 or those two &amp;gt;0xFFFF multiplier constants &amp;nbsp;to long, else it won't work when int is 16 bits wide.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 12:08:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195019#M7161</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-03-30T12:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195020#M7162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean with stuch? Does sprintf not return? if that is the case I would try to increase the stack space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are different versions in different libraries provided, some support floating point, some not. But all of the&lt;/P&gt;&lt;P&gt;versions do support printing long. Especially the floating point versions need quite a bit of stack space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 14:05:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195020#M7162</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2011-03-30T14:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195021#M7163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might not be the most efficient way to code it, but I think that the original code should work.&lt;/P&gt;&lt;P&gt;BYTE3/BYTE4 do not need to be longs because they are multiplied with long constants, so the multiplication gets performed with enough bits anyhow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hmm on a second thought the&amp;nbsp;BYTE2*0x100 summand is problematic. &amp;nbsp;The issue is that multiplication result tyoe is probably an signed int (probably, as it depends on the not given type of BYTE2), not of type unsigned int (or long, unsigned long).&lt;/P&gt;&lt;P&gt;And if it is int, then it gets sign extended to a long...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To fix that, use 0x100u or else the highest bit of BYTE2 may count as -2^^16...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tipically write it with shifts, and then an explicit cast to (unsigned) long is necessart when shifting by 16 or more bits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyhow I guess the issue in the end is too little stack space allocated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW: It's also a bit uncommon that a variable called&amp;nbsp;result_unsigned_int has a type of unsigned long :smileyhappy:.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 14:23:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195021#M7163</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2011-03-30T14:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195022#M7164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Compilerguru,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, it's not the case&amp;nbsp;using Codewarrior&amp;nbsp;S12(X), that&amp;nbsp;&amp;nbsp;char * 0x10000&amp;nbsp; or short * 0x10000 are chopped to 16bits. I'm not sure if this should be the same using other compilers. I believed that constant isn't long without L suffix, even if it&amp;nbsp;is more than 0xFFFF. Is it? In all compilers? You must be&amp;nbsp;right, I should consult C specs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what&amp;nbsp;result from above should give for char BYTE4..1 set to 0xF4,0xF3..0xF1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a).BYTEn are unsigned char's:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;byte4 * 0x1000000 should give 0xF4000000, of course if constant is treated as long.&lt;/P&gt;&lt;P&gt;byte3 * 0x10000 , should give 0x00F30000&lt;/P&gt;&lt;P&gt;byte2 * 0x100 gives int = 0xF200, which is then sign extended to long givinh 0xFFFFF200&lt;/P&gt;&lt;P&gt;byte1 directly converted to long gives 0x000000F1.&lt;/P&gt;&lt;P&gt;The sum should be&amp;nbsp;0xF4F2F2F1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b)&amp;nbsp;BYTEn are signed char's:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;byte4 * 0x1000000 should give 0xF4000000&lt;/P&gt;&lt;P&gt;byte3 * 0x10000 , should give 0xFFF30000&lt;/P&gt;&lt;P&gt;byte2 * 0x100 gives int = 0xF200, which is then sign extended to long givinh 0xFFFFF200&lt;/P&gt;&lt;P&gt;byte1 directly converted to long gives 0xFFFFFFF1.&lt;/P&gt;&lt;P&gt;The sum should be&amp;nbsp;0xF3F2F1F1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 15:57:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195022#M7164</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-03-30T15:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195023#M7165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for discussion!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I spent last exening and half of night to solve this - without results....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To avoid a possible problems with&amp;nbsp; result claculation (mentioned abow - BYTEx are unsigned char so it works fine). I tried to convert a direct declared variable result_insigned_int=0xFFFFFFFF and convert it using sprintf(out,"%lu",result_unsigned int)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;out is declared as:&lt;/P&gt;&lt;P&gt;char out[11];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe it is something with stack size as CompilerGuru wrote...digging in stack settings will be difficult for me - I'm begginer &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;Could you try to run this simple code on your 8-bit uC(my is JM60):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unsigned long int in=0xFFFFFFFF;&lt;/P&gt;&lt;P&gt;char out[11];&lt;/P&gt;&lt;P&gt;sprintf(out,"%lu",in);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you get in out? As I wrote abow it works in simulation mode but stucks in BDM.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 16:48:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195023#M7165</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-03-30T16:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195024#M7166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like the solution has been found!&lt;/P&gt;&lt;P&gt;I've followed &lt;EM&gt;&lt;STRONG&gt;ComplierGuru&lt;/STRONG&gt;&lt;/EM&gt; suggestion and I've changed Stack size in Project.prm from 0x80 to 0x100 and now it works perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wondering why old stack size wasn't enough. I don't use interrupts and any complicated calculations aren't performed in my project...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for advise! Another usefull lesson....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2011 06:07:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195024#M7166</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-03-31T06:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195025#M7167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more Thanks for CompilerGuru...&amp;nbsp; BYTEs multiplication must be done by 0x100u otherwise Byte is extended as signed....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2011 05:41:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195025#M7167</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-04-01T05:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195026#M7168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why would you use sprintf() in an embedded application?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;void gpfunc_getDecStr (uint8* str, uint8 len, uint32 val)
{
  uint8 i;
 
  for(i=1; i&amp;lt;=len; i++)
  {
    str[len-i] = (uint8) ((val % 10UL) + '0');
    val/=10;
  }
 
  str[i-1] = '\0';
}
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That simple snippet takes 76 bytes on my S12. Personally, I have no particular urge to blow several kb of flash and RAM to do the very same thing with sprintf(), in a much slower fashion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:49:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195026#M7168</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2020-10-29T09:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unsigned long int to ASCII conversion  - failed</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195027#M7169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Lundin&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I've just started uC and C programming so sprintf was first choose (easiest).&lt;/P&gt;&lt;P&gt;Your code shows me a different point of view and of coures it works fine!&lt;/P&gt;&lt;P&gt;Beauty of C....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2011 20:23:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Unsigned-long-int-to-ASCII-conversion-failed/m-p/195027#M7169</guid>
      <dc:creator>gooral</dc:creator>
      <dc:date>2011-04-05T20:23:40Z</dc:date>
    </item>
  </channel>
</rss>

