<?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: Losing code flow with MC9S08QG8. Help needed. in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201485#M7585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for answering.&lt;BR /&gt;&lt;BR /&gt;Yes, my mistake. I thought that just because I was declaring char [2], there were 3 positions ([0], [1] and [2]). That's what happens when one uses two different languages at the same time &lt;SPAN&gt;&lt;IMG alt=":smileytongue:" class="emoticon emoticon-smileytongue" id="smileytongue" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-tongue.gif" title="Smiley Tongue" /&gt;&lt;/SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;So, problem solved. Thanks!&lt;BR /&gt;&lt;BR /&gt;@ CompilerGuru: Indeed, I first used Itoa but I had some issues which I couldn't solve. I checked at this forum and foud Technoman64's one, tried it and worked well. And you're right, I could use a simplier Itoa, just to convert short numbers (decimals) into strings. Unfortunately, I couldn't find one and I wouldn't be sure of writing a good one. If anyone wants to drop a link, would be pretty welcome.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Nov 2008 10:58:22 GMT</pubDate>
    <dc:creator>neocronos</dc:creator>
    <dc:date>2008-11-12T10:58:22Z</dc:date>
    <item>
      <title>Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201481#M7581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I've been working on this project with a couple of MC9S08QG8 and some ZigBee devices. Because of data type issues with the communication protocol, I decided to use &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fforums.freescale.com%2Fmessage%3Fboard.id%3DCWCOMM%26message.id%3D5427%26query.id%3D16366%23M5427" rel="nofollow noopener noreferrer" target="_blank"&gt;Technoman64's itoa code&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void cargarpaq()
{&amp;nbsp; 
&amp;nbsp; char oriDirTmp[1];
&amp;nbsp; char desDirTmp[1];
&amp;nbsp; char msgTipTmp[2];
&amp;nbsp; char msgRecTmp[2];
 
&amp;nbsp; ItoaMsg(&amp;amp;oriDirTmp[0], "", device1, 1, 0);
&amp;nbsp; oriDirSnd = oriDirTmp[0];

&amp;nbsp; ItoaMsg(&amp;amp;desDirTmp[0], "", coordin, 1, 0);
&amp;nbsp; desDirSnd = desDirTmp[0];
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; ItoaMsg(&amp;amp;msgTipTmp[0], "", msgCateg, 2, 0);
&amp;nbsp; msgTipSnd[0] = msgTipTmp[0];
&amp;nbsp; msgTipSnd[1] = msgTipTmp[1];
 
&amp;nbsp; ItoaMsg(&amp;amp;msgRecTmp[0], "", msgTarea, 2, 0);&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; msgRecSnd[0] = msgRecTmp[0];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; msgRecSnd[1] = msgRecTmp[1];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 
&amp;nbsp; rellenela(allSnd);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;It does the rutine but then it goes lost at the end, it does't return to where it started, instead, it does some assembly code (which I honestly don't know what is about), then goes to a time interruption and finally it jumps back to a wrong point, missing several rutine calls.&lt;BR /&gt;&lt;BR /&gt;Here is a &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fi82.photobucket.com%2Falbums%2Fj261%2Fneocronos%2Fflowlost.jpg" rel="nofollow noopener noreferrer" target="_blank"&gt;screenshot&lt;/A&gt; of the debugger, if it helps.&lt;BR /&gt;&lt;BR /&gt;I'm guessing I'm having ram or flash memory issues but I wouldn't know well how to solve them, so, I could use some ideas &lt;SPAN&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2008 00:09:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201481#M7581</guid>
      <dc:creator>neocronos</dc:creator>
      <dc:date>2008-11-12T00:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201482#M7582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I just found something. I copied the whole function code and pasted it into the last used function and it worked fine, which means that the code is well written and the problem should be ... no idea.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cargarack();&amp;nbsp; // To here, and it works good&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cargarpaq();&amp;nbsp; // Copied the code from here&lt;BR /&gt;&lt;BR /&gt;Sorry if it seems a little newbie. It seems to me too, still don't know why it happens.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2008 05:59:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201482#M7582</guid>
      <dc:creator>neocronos</dc:creator>
      <dc:date>2008-11-12T05:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201483#M7583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;To write a 2 character number, you need 3 characters, don't forget the terminating 0 byte.&lt;BR /&gt;Your code seems not to allocate the byte for the terminating 0 byte.&lt;BR /&gt;I'm also not sure why you are using ItoaMsg and not Itoa, the ItoaMsg prepends an secondary string in front, but in your code that additional string is always empty, so it does not do more than Itoa.&lt;BR /&gt;&lt;BR /&gt;Also Itoa's main advanced feature seems to be to support to add a decimal point, to print the number&lt;BR /&gt;as fixed point number. Does not look like you need/want/use that so a simpler itoa would be sufficient.&lt;BR /&gt;In case you need the added decimal point too, it also needs an output character.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2008 08:07:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201483#M7583</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-11-12T08:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201484#M7584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I notice that you have declared some one element arrays.&amp;nbsp; These are not suitable for storage of string data since there is no allowance made for a terminating null character.&amp;nbsp; The size of each buffer needs to be one more than the required length of the string.&lt;BR /&gt;&lt;BR /&gt;For the conversion of a signed integer value, the buffer size should allow for five decimal digits, plus sign and decimal point, plus the null termination - a minimum buffer length of eight bytes.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mac&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2008 08:35:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201484#M7584</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-11-12T08:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201485#M7585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for answering.&lt;BR /&gt;&lt;BR /&gt;Yes, my mistake. I thought that just because I was declaring char [2], there were 3 positions ([0], [1] and [2]). That's what happens when one uses two different languages at the same time &lt;SPAN&gt;&lt;IMG alt=":smileytongue:" class="emoticon emoticon-smileytongue" id="smileytongue" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-tongue.gif" title="Smiley Tongue" /&gt;&lt;/SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;So, problem solved. Thanks!&lt;BR /&gt;&lt;BR /&gt;@ CompilerGuru: Indeed, I first used Itoa but I had some issues which I couldn't solve. I checked at this forum and foud Technoman64's one, tried it and worked well. And you're right, I could use a simplier Itoa, just to convert short numbers (decimals) into strings. Unfortunately, I couldn't find one and I wouldn't be sure of writing a good one. If anyone wants to drop a link, would be pretty welcome.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2008 10:58:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201485#M7585</guid>
      <dc:creator>neocronos</dc:creator>
      <dc:date>2008-11-12T10:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Losing code flow with MC9S08QG8. Help needed.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201486#M7586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Here is some code I once wrote. It is MISRA C compliant, so please bear with all the 'U':s and typecasts. I'm not using it in any production code yet, so should you find any bugs, do let me know! &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;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;extern BOOL gpfunc_itoa (uint16 value, uint8 buf[], uint16 buf_size, uint16* bytes_written);
/*
DESCRIPTION        Int to ASCII character conversion for 16-bit integers.

PARAMETERS

  [value]          The integer value to convert.

  [buf]            A pointer to an allocated buffer of [buf_size] bytes that
                   will contain the null-terminated string which is the result.

  [buf_size]       The size of [buf] in bytes.
 
  [bytes_written]  A pointer to an allocated uint16 variable which will contain
                   the number of bytes written by the function.

RETURNS            TRUE if the function was successful, otherwise FALSE.
*/

BOOL gpfunc_itoa (uint16 value, uint8 buf[], uint16 buf_size, uint16* bytes_written)
{
  BOOL    result;
  uint16  div;
  uint16  i;
  BOOL    remove_zeroes;

  i = 0U;
  remove_zeroes = TRUE;
  div = 10000U;

  while((div != 0U) &amp;amp;&amp;amp; (i &amp;lt; buf_size))
  {
    uint8 ch;

    ch = (uint8)((value / div) + '0');

    if(remove_zeroes &amp;amp;&amp;amp; (ch == '0'))
    {
      if(value == 0U)
      {
        buf[i] = ch;
        i++;
        break;
      }
      else
      {
        ;                                        /* skip leading zeroes */
      }
    }
    else
    {
      buf[i] = ch;
      remove_zeroes = FALSE;
      i++;
    }

    value %= div;
    div /= 10U;
  }

  if(i == buf_size)
  {
    result = FALSE;
  }
  else
  {
    buf[i] = '\0';
    result = TRUE;
  }
 
  return result;
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2008 21:01:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Losing-code-flow-with-MC9S08QG8-Help-needed/m-p/201486#M7586</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2008-11-13T21:01:32Z</dc:date>
    </item>
  </channel>
</rss>

