<?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: Accessing individual bytes in a long int in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253984#M9756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, our dear friend &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/bigmac"&gt;bigmac&lt;/A&gt; ROCKS :smileygrin:&lt;/P&gt;&lt;P&gt;And so do you, keep the developing mood on!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Monica.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 May 2013 00:11:16 GMT</pubDate>
    <dc:creator>Monica</dc:creator>
    <dc:date>2013-05-31T00:11:16Z</dc:date>
    <item>
      <title>Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253979#M9751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to assemble a 4 byte int (long int) from four individual bytes that I am reading from a Flash memory device. Using lots of shifts seems a bit clumsy. Is there a method using a pointer to the long int to access the individual bytes? It seems a bit of a trivial question I know but I am a bit rusty with pointers. I'm using&amp;nbsp; a 9S08QE8.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 08:39:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253979#M9751</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2013-05-23T08:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253980#M9752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One simple method is to create a union between the 32-bit value and a 4-element array.&amp;nbsp; For example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;typedef union {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; unsigned long lword;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; unsigned char a[4];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;} TYPE_32BIT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;TYPE_32BIT val;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access to 8-bit elements can be achieved with &lt;SPAN style="font-family: courier new,courier;"&gt;val.a[i]&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;, and access to the 32-bit quantity with &lt;SPAN style="font-family: courier new,courier;"&gt;v&lt;/SPAN&gt;&lt;/SPAN&gt;al.lword&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 12:47:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253980#M9752</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2013-05-23T12:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253981#M9753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Steve!&lt;/P&gt;&lt;P&gt;Did you get to try that out? How did it go?&lt;/P&gt;&lt;P&gt;Keep us posted! :smileywink:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Monica.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 02:06:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253981#M9753</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2013-05-30T02:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253982#M9754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Monica,&lt;/P&gt;&lt;P&gt;No I haven't had a chance yet. I had figured out a less efficient way round it so it works after a fashion (although I have not looked at the assembler to check). I am also not familiar with using unions so need to look that up to see how it works. I've been diverted onto another project temporarily. I'll get back to you when I get back on project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 06:02:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253982#M9754</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2013-05-30T06:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253983#M9755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Monica,&lt;/P&gt;&lt;P&gt;I had a chance to try the union solution that bigmac suggested. Works a treat and a much more elegant solution than lots of shifts, and a lot quicker. So thanks Mac. I hadn't got to the chapter on Unions yet. That's a lot further on in the book!! So it must be complicated, right? I hadn't realised it was so simple. Something new learnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 May 2013 15:10:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253983#M9755</guid>
      <dc:creator>stevec</dc:creator>
      <dc:date>2013-05-30T15:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing individual bytes in a long int</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253984#M9756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, our dear friend &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/bigmac"&gt;bigmac&lt;/A&gt; ROCKS :smileygrin:&lt;/P&gt;&lt;P&gt;And so do you, keep the developing mood on!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Monica.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 00:11:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Accessing-individual-bytes-in-a-long-int/m-p/253984#M9756</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2013-05-31T00:11:16Z</dc:date>
    </item>
  </channel>
</rss>

