<?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: lpc1114 GPIO problem in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534091#M10762</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alexan.e on Fri May 25 11:49:47 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In your second example you use = (1&amp;lt;&amp;lt;3)|(0&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any value ORed with 0 keeps the value it had so what is the purpose of |(0&amp;lt;&amp;lt;5)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:33:48 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:33:48Z</dc:date>
    <item>
      <title>lpc1114 GPIO problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534088#M10759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mshrestha789 on Tue Jan 17 22:04:02 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having problem with masking the bit for reading and writing operation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's what I am doing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;DIR |= (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In above code, it is suppose to mask only 3rd and 5th bits of GPIO 0. Bit it masks all bits. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Another strange thing I notice that in above code, replacing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[0] = (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;makes no difference. Here in place of 0, writing any number makes no difference. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can any one help??&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:33:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534088#M10759</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1114 GPIO problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534089#M10760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Wouter on Fri Feb 10 08:58:31 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should work just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What pins do you see changing? All of GPIO0 pins? Did you set these pins as output, or are the pins set as input (default) and do you maybe see a high-level on these pins because of the pull-up resistors (enabled by default)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could try the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;DIR = 0x0FFF;//All GPIO0 pins as output&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;DATA = 0x0000;//All GPIO0 pins low&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5);//Now set only PIO0.3 &amp;amp; PIO0.5 high&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;DATA = 0x0FFF;//All GPIO0 pins high&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = 0;//Now clear only PIO0.3 &amp;amp; PIO0.5&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can check the behavior by setting two breakpoints, each after writing to "LPC_GPIO0-&amp;gt;MASKED_ACCESS".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please also note that PIO0.5 is an open-drain output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wouter&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:33:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534089#M10760</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1114 GPIO problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534090#M10761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheoVanManen on Sat Feb 18 15:03:17 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Using MASKED_ACCESS:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It toke me some time to understand how the 'Masked_Access' worked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not some example C-lines added in the User Manual?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;example 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5); //Now set only PIO0.3 &amp;amp; PIO0.5 high&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... means: address '['(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)']' =&amp;gt; only bit 3 and 5 are involved in the bitoperation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... after the '=' (1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5) means: bit 3 is set to '1' and bit 5 = set to '1'.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;example 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3)|(0&amp;lt;&amp;lt;5); // is equal to&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO0-&amp;gt;MASKED_ACCESS[(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] = (1&amp;lt;&amp;lt;3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... means: [(1&amp;lt;&amp;lt;3)|(1&amp;lt;&amp;lt;5)] =&amp;gt; only bit 3 and 5 are involved in the bitoperation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;... after the '=' (1&amp;lt;&amp;lt;3)|(0&amp;lt;&amp;lt;5) means: bit 3 is set to '1' and bit 5 = set to '0'.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wouter, thanks for your explanation.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:33:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534090#M10761</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1114 GPIO problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534091#M10762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by alexan.e on Fri May 25 11:49:47 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;In your second example you use = (1&amp;lt;&amp;lt;3)|(0&amp;lt;&amp;lt;5); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any value ORed with 0 keeps the value it had so what is the purpose of |(0&amp;lt;&amp;lt;5)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:33:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534091#M10762</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1114 GPIO problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534092#M10763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by PhilYoung on Fri May 25 15:18:19 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been using a simple macro for this for a long time with no problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#define SET_GPIO(Port,Bits)(Port-&amp;gt;MASKED_ACCESS[(Bits)] = (Bits))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#define CLR_GPIO(Port,Bits)(Port-&amp;gt;MASKED_ACCESS[(Bits)] = (0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this agrees with wouters code above, so if things aren't changing I suggest checking first the pin configuration and then the PCB for shorts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;technically &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#define SET_GPIO(Port,Bits)(Port-&amp;gt;MASKED_ACCESS[(Bits)] = (0xffff))&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;would also produce the same results, since it is a masked write, but the first may be more efficient as the compiler usually loads (Bits) into a register anyway &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a more generic code would be &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define SET_GPIO(Port,Bits,Val)(Port-&amp;gt;MASKED_ACCESS[(Bits)] = (Val))&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:33:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1114-GPIO-problem/m-p/534092#M10763</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:33:48Z</dc:date>
    </item>
  </channel>
</rss>

