<?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>LPC Microcontrollers中的主题 LPCOpen : Why we use '~' in the Reseved bits masks for registers ?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-Why-we-use-in-the-Reseved-bits-masks-for-registers/m-p/692933#M27927</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the snapshot from "syscon_8xx.h" file of lpcopen library. If you see, everywhere they have used '~'.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19390iAB8BEA01F16F9CEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, take SYSAHBCLKDIV register in LPC812.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19438iCCFD0C623994E2B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here Bits &amp;lt;31:8&amp;gt; are reserved bits. We could have defined&lt;/P&gt;&lt;P&gt;#define SYSCTL_SYSAHBCLKDIV_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp; (0xffffff)&lt;/P&gt;&lt;P&gt;But why did LPCOpen use &amp;nbsp; &amp;nbsp;&amp;nbsp; #define SYSCTL_SYSAHBCLKDIV_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp; (~0xff) &amp;nbsp; &amp;nbsp; &amp;nbsp; instead ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 May 2017 00:15:26 GMT</pubDate>
    <dc:creator>karthikvenkates</dc:creator>
    <dc:date>2017-05-25T00:15:26Z</dc:date>
    <item>
      <title>LPCOpen : Why we use '~' in the Reseved bits masks for registers ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-Why-we-use-in-the-Reseved-bits-masks-for-registers/m-p/692933#M27927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the snapshot from "syscon_8xx.h" file of lpcopen library. If you see, everywhere they have used '~'.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19390iAB8BEA01F16F9CEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, take SYSAHBCLKDIV register in LPC812.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19438iCCFD0C623994E2B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here Bits &amp;lt;31:8&amp;gt; are reserved bits. We could have defined&lt;/P&gt;&lt;P&gt;#define SYSCTL_SYSAHBCLKDIV_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp; (0xffffff)&lt;/P&gt;&lt;P&gt;But why did LPCOpen use &amp;nbsp; &amp;nbsp;&amp;nbsp; #define SYSCTL_SYSAHBCLKDIV_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp; (~0xff) &amp;nbsp; &amp;nbsp; &amp;nbsp; instead ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 00:15:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-Why-we-use-in-the-Reseved-bits-masks-for-registers/m-p/692933#M27927</guid>
      <dc:creator>karthikvenkates</dc:creator>
      <dc:date>2017-05-25T00:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen : Why we use '~' in the Reseved bits masks for registers ?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-Why-we-use-in-the-Reseved-bits-masks-for-registers/m-p/692934#M27928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The '~' operator is a 'binary-negate' operator in C. The reserved bitmask would be 0xFFFFFF00 (and not 0xFFFFFF as you wrote). And ~0xFF will be exactly that 0xFFFFFF00. You could use both notations. I would prefer 0xFFFFFF00 too, but ~0xFF is shorter :-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 06:11:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-Why-we-use-in-the-Reseved-bits-masks-for-registers/m-p/692934#M27928</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2017-05-25T06:11:26Z</dc:date>
    </item>
  </channel>
</rss>

