<?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: Help for Simple program code</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155923#M4014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the 24-bit data is arranged in little endian format, it is probably simplest to treat the problem as&amp;nbsp;three separate additions of single byte values,&amp;nbsp;within three byte arrays.&amp;nbsp; Had the data arrangement been big endian (native to the MCU), a different approach might be adopted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code snippet provides&amp;nbsp;a function uses this method.&amp;nbsp; For simplicity, the snippet does not provide 24-bit overflow handling.&amp;nbsp; This may need to be added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    void add24( char *p1, char *p2, char *pr){   unsigned int i, r, c = 0;      for (i = 0; i &amp;lt; 3; i++) {      r = p1[i] + p2[i] + c;      c = r &amp;gt;&amp;gt; 8;      pr[i] = (char)(r &amp;amp; 0x00FF);   }}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function would be called in the following manner -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Global variables - little endian 24-bit formatbyte var1[3] @ 0x3000 = { 0x45, 0x23, 0x01}; // byte var2[3] @ 0x3003 = { 0xAB, 0x89, 0x67};byte var3[3] @ 0x3006;    ...      add24( var1, var2, var3);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 08:59:58 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2020-10-29T08:59:58Z</dc:date>
    <item>
      <title>Help for Simple program code</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155922#M4013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I'm new here, so please be patient witm me! &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif"&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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I need to write a simple code and the question is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I need to tipe a program which runs on HCS12 microcontroler.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I must &lt;SPAN style="line-height: normal;"&gt;write&lt;/SPAN&gt;&amp;nbsp;a program that will&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;run on&lt;/SPAN&gt;&amp;nbsp;HCS12, which&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;adds up two&amp;nbsp;24-bits&amp;nbsp;&lt;/SPAN&gt;values&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;that&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;are&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;written down&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;locations&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3000&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3002&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;and the lowest nubmer&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;is&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;on&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;location&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3000&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;-&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;lowest&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;byte&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&amp;nbsp;and other 24-bit number is&amp;nbsp;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;location&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3003&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;to&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;$&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000;"&gt;&lt;SPAN&gt;3005&amp;nbsp;and again the lower value in on location $3003.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;must be&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;writen down&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;24&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;bit&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;number&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;that&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;occupies&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;location&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3006&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;$3008&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Shortly&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;describe&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&amp;nbsp;a concept&amp;nbsp;of suming&amp;nbsp;the&amp;nbsp;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;numbers&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;which&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;are&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;longer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;8&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;bits&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;on&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fpresis.amebis.si%2Fprevajanje%2F" rel="nofollow" target="_blank"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;such&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;&lt;SPAN style="line-height: normal;"&gt;mi&lt;/SPAN&gt;&lt;SPAN&gt;crocontroler.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks for any help given!&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 02:17:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155922#M4013</guid>
      <dc:creator>soonny</dc:creator>
      <dc:date>2012-04-20T02:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help for Simple program code</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155923#M4014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the 24-bit data is arranged in little endian format, it is probably simplest to treat the problem as&amp;nbsp;three separate additions of single byte values,&amp;nbsp;within three byte arrays.&amp;nbsp; Had the data arrangement been big endian (native to the MCU), a different approach might be adopted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code snippet provides&amp;nbsp;a function uses this method.&amp;nbsp; For simplicity, the snippet does not provide 24-bit overflow handling.&amp;nbsp; This may need to be added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    void add24( char *p1, char *p2, char *pr){   unsigned int i, r, c = 0;      for (i = 0; i &amp;lt; 3; i++) {      r = p1[i] + p2[i] + c;      c = r &amp;gt;&amp;gt; 8;      pr[i] = (char)(r &amp;amp; 0x00FF);   }}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function would be called in the following manner -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Global variables - little endian 24-bit formatbyte var1[3] @ 0x3000 = { 0x45, 0x23, 0x01}; // byte var2[3] @ 0x3003 = { 0xAB, 0x89, 0x67};byte var3[3] @ 0x3006;    ...      add24( var1, var2, var3);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:59:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155923#M4014</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2020-10-29T08:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help for Simple program code</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155924#M4015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helpibg me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I missed wrong part of forum, but program must be writed in code like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LDX #0000&lt;/P&gt;&lt;P&gt;CLRA&lt;/P&gt;&lt;P&gt;LDAA $3000&lt;/P&gt;&lt;P&gt;ADDA $3001&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something in this way!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...and I have no idea what to do!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 20:10:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155924#M4015</guid>
      <dc:creator>soonny</dc:creator>
      <dc:date>2012-04-20T20:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help for Simple program code</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155925#M4016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it's quite simple to do it on assembly, if you still need help let me know, i acctually made a 100 bit addition so it's failry simple to make it shorter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 23:53:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Help-for-Simple-program-code/m-p/155925#M4016</guid>
      <dc:creator>Tompzone</dc:creator>
      <dc:date>2012-05-15T23:53:15Z</dc:date>
    </item>
  </channel>
</rss>

