<?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: TO Peg,rhinocerohead and Bigmac,please help ! in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125061#M492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Pardon my complete ignorance, but how is the first problem 15 and not 7?&lt;BR /&gt;&lt;BR /&gt;KBD_MAX_ROW=4&lt;BR /&gt;(1 KBD_MAX_ROW) - 1&lt;BR /&gt;&lt;BR /&gt;the 1 is a bit shift to the left or Multiply by "2"&lt;BR /&gt;&lt;BR /&gt;so 0b00000100 x 2 = 0b1000 or 8... 8 - 1 = 7?&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 Jul 2006 00:59:30 GMT</pubDate>
    <dc:creator>mjcoury</dc:creator>
    <dc:date>2006-07-29T00:59:30Z</dc:date>
    <item>
      <title>TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125059#M490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi guys!.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Could you help to understand what does these code lines do?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Let`s suppose KBD_MAX_ROW=4&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;1) temp = (1 &amp;lt;&amp;lt; KBD_MAX_ROW) - 1&amp;nbsp;&amp;nbsp; Is this code line equal to 7 (0111)?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; 2)Let`s suppose KBD_COL_DDR= DDRA&amp;nbsp; and KBD_COL_PORT&amp;nbsp;=PORTA&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KBD_COL_DDR&amp;nbsp; |= temp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What is the meaning of this notation?&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KBD_COL_PORT &amp;amp;= ~temp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What is the meaning of this notation?&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Ganimides&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jul 2006 04:06:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125059#M490</guid>
      <dc:creator>ganimides</dc:creator>
      <dc:date>2006-07-27T04:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125060#M491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;FONT size="2"&gt;Hello ganimides,&lt;BR /&gt;&lt;/FONT&gt; &lt;BLOCKQUOTE&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt; &lt;HR /&gt;&lt;FONT size="2"&gt;ganimides wrote&lt;/FONT&gt;:&lt;BR /&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Could you help to understand what does these code lines do?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Let`s suppose KBD_MAX_ROW=4&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&amp;nbsp;1) temp = (1 &amp;lt;&amp;lt; KBD_MAX_ROW) - 1&amp;nbsp;&amp;nbsp; Is this code line equal to 7 (0111)?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&amp;nbsp;2)Let`s suppose KBD_COL_DDR= DDRA&amp;nbsp; and KBD_COL_PORT&amp;nbsp;=PORTA&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;KBD_COL_DDR&amp;nbsp; |= temp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What is the meaning of this notation?&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;KBD_COL_PORT &amp;amp;= ~temp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What is the meaning of this notation?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt; &lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;1) temp = (1 &amp;lt;&amp;lt; KBD_MAX_ROW) - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;= (%00010000) - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;= %00001111 or 15 decimal&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;2a) KBD_COL_DDR&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;|= temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;is&amp;nbsp;shorthand for&lt;BR /&gt;&amp;nbsp;&amp;nbsp;KBD_COL_DDR = KBD_COL_DDR | temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;FONT face="Arial"&gt;This sets one or more bits in accordance with the mask value held in&lt;/FONT&gt; temp.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;2b) KBD_COL_PORT &amp;amp;= ~temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;is shorthand for&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;KBD_COL_PORT = KBD_COL_PORT &amp;amp; ~temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face="Arial"&gt;This clears one or more bits in accordance with the mask value held in&lt;/FONT&gt; temp.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Regards,&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;BR /&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jul 2006 05:24:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125060#M491</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-07-27T05:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125061#M492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Pardon my complete ignorance, but how is the first problem 15 and not 7?&lt;BR /&gt;&lt;BR /&gt;KBD_MAX_ROW=4&lt;BR /&gt;(1 KBD_MAX_ROW) - 1&lt;BR /&gt;&lt;BR /&gt;the 1 is a bit shift to the left or Multiply by "2"&lt;BR /&gt;&lt;BR /&gt;so 0b00000100 x 2 = 0b1000 or 8... 8 - 1 = 7?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Jul 2006 00:59:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125061#M492</guid>
      <dc:creator>mjcoury</dc:creator>
      <dc:date>2006-07-29T00:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125062#M493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;It is 15.&amp;nbsp; As you said, the bit shift is exactly like multiplying by 2.&amp;nbsp; We started with the number 1 and we bit shifted four times, or multiplied by 2 four times.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;0000 0001 start with this&lt;/DIV&gt;&lt;DIV&gt;0000 0010 after 1st bit shift (=2)&lt;/DIV&gt;&lt;DIV&gt;0000 0100 after 2nd bit shift (=4)&lt;/DIV&gt;&lt;DIV&gt;0000 1000 after 3rd bit shift (=8)&lt;/DIV&gt;&lt;DIV&gt;0001 0000 after 4th bit shift (=16)&lt;/DIV&gt;&lt;DIV&gt;0000 1111 after subtracting 1 (=15)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively, 1*2*2*2*2 - 1= 2^4 -1 = 15&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It looks like the code is just trying to generate a bitmask that is justified to the right, given a parameter of how many bits need to be in the mask.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Jul 2006 01:19:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125062#M493</guid>
      <dc:creator>rhinoceroshead</dc:creator>
      <dc:date>2006-07-29T01:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125063#M494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Seeing how I was invited and all, I will attempt to make it even a little clearer:&lt;/P&gt;&lt;P&gt;1 &amp;lt;&amp;lt; KBD_MAX_ROW&lt;/P&gt;&lt;P&gt;is 1 &amp;lt;&amp;lt; 4&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt; means left shift the thing on the left by the number of bits on the right&lt;/P&gt;&lt;P&gt;(shift 1 to the left 4 times)&lt;/P&gt;&lt;P&gt;now look at rhino's binary example.&lt;/P&gt;&lt;P&gt;As for the other two, refer to bigmac's expansions then note that:&lt;/P&gt;&lt;P&gt;| means bitwise OR&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001010 | 00000011 = 00001011&lt;/P&gt;&lt;P&gt;&amp;amp; means bitwise AND&amp;nbsp;&amp;nbsp;&amp;nbsp; 00001010 &amp;amp; 00000011 = 00000010&lt;/P&gt;&lt;P&gt;~ means one's complement (NOT)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~00001010 = 11110101&lt;/P&gt;&lt;P&gt;(values chosen are arbitrary)&lt;/P&gt;&lt;P&gt;Then read bigmac's beautifully concise one sentence explanation for their most common use.&lt;/P&gt;&lt;P&gt;Regards David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;2006-07-29&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:29 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Jul 2006 06:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125063#M494</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-07-29T06:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: TO Peg,rhinocerohead and Bigmac,please help !</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125064#M495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Thank you very much guys!!!!...&lt;/P&gt;&lt;P&gt;I`ve been very ill the last weeks and I just have reincorporated since 2 days ago.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ganimides&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 21:49:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/TO-Peg-rhinocerohead-and-Bigmac-please-help/m-p/125064#M495</guid>
      <dc:creator>ganimides</dc:creator>
      <dc:date>2006-08-18T21:49:47Z</dc:date>
    </item>
  </channel>
</rss>

