<?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>LPCXpresso IDE中的主题 Re: Problem setting pin P2.0 as GPIO in LPC1768</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565515#M18052</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ngoncalves on Tue Apr 24 08:29:29 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It was an hardware/human problem. I was reading the wrong pin, because I got confused with the markings on the processor. Three circles, but only one of them is the little one..... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 00:58:37 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T00:58:37Z</dc:date>
    <item>
      <title>Problem setting pin P2.0 as GPIO in LPC1768</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565513#M18050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ngoncalves on Tue Apr 24 07:21:15 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the following code to set pins P2.0 to P2.4 as outputs and set their value:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
uint8_t pinsel = 0 ;
uint8_t pin&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0 ;

// P2.0
LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(3 &amp;lt;&amp;lt; pinsel) ;
LPC_GPIO2-&amp;gt;FIODIR0&amp;nbsp; |=&amp;nbsp; (1 &amp;lt;&amp;lt; pin) ;
LPC_GPIO2-&amp;gt;FIOSET0 |= (1 &amp;lt;&amp;lt; pin) ;
delay(25) ;
LPC_GPIO2-&amp;gt;FIOCLR0 |= (1 &amp;lt;&amp;lt; pin) ;


// P2.1
pinsel += 2 ;
pin++ ;
LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(3 &amp;lt;&amp;lt; pinsel) ;
LPC_GPIO2-&amp;gt;FIODIR0&amp;nbsp; |=&amp;nbsp; (1 &amp;lt;&amp;lt; pin) ;
LPC_GPIO2-&amp;gt;FIOSET0 |= (1 &amp;lt;&amp;lt; pin) ;
delay(25) ;
LPC_GPIO2-&amp;gt;FIOCLR0 |= (1 &amp;lt;&amp;lt; pin) ;

// P2.2
pinsel += 2 ;
pin++ ;
LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(3 &amp;lt;&amp;lt; pinsel) ;
LPC_GPIO2-&amp;gt;FIODIR0&amp;nbsp; |=&amp;nbsp; (1 &amp;lt;&amp;lt; pin) ;
LPC_GPIO2-&amp;gt;FIOSET0 |= (1 &amp;lt;&amp;lt; pin) ;
delay(25) ;
LPC_GPIO2-&amp;gt;FIOCLR0 |= (1 &amp;lt;&amp;lt; pin) ;

// P2.3
pinsel += 2 ;
pin++ ;
LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(3 &amp;lt;&amp;lt; pinsel) ;
LPC_GPIO2-&amp;gt;FIODIR0&amp;nbsp; |=&amp;nbsp; (1 &amp;lt;&amp;lt; pin) ;
LPC_GPIO2-&amp;gt;FIOSET0 |= (1 &amp;lt;&amp;lt; pin) ;
delay(25) ;
LPC_GPIO2-&amp;gt;FIOCLR0 |= (1 &amp;lt;&amp;lt; pin) ;

// P2.4
pinsel += 2 ;
pin++ ;
LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(3 &amp;lt;&amp;lt; pinsel) ;
LPC_GPIO2-&amp;gt;FIODIR0&amp;nbsp; |=&amp;nbsp; (1 &amp;lt;&amp;lt; pin) ;
LPC_GPIO2-&amp;gt;FIOSET0 |= (1 &amp;lt;&amp;lt; pin) ;
delay(25) ;
LPC_GPIO2-&amp;gt;FIOCLR0 |= (1 &amp;lt;&amp;lt; pin) ;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am following the datasheet, as far as I cant tell, but only P2.2 to P2.4 are actually set as GPIO's.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason, in debug the processor registers show P2.0 and P2.1 being properly setup as GPIO (and the value is changing according to LPC_GPIO2-&amp;gt;FIOPIN0), but there is no change on the physical pins (measuring with an oscilloscope).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried disabling the other two peripherals that use these pins (USART1 and PWM1) without success. Is there something I am not doing correctly ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Nelson&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:58:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565513#M18050</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting pin P2.0 as GPIO in LPC1768</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565514#M18051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Ex-Zero on Tue Apr 24 08:28:02 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The code you've posted is working without problems with my LPC1768 here after inserting it in new LPCXpresso project :eek:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So either you have a hardware problem or your project setup is wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps you want to reduce your project and post it :rolleyes:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:58:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565514#M18051</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting pin P2.0 as GPIO in LPC1768</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565515#M18052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ngoncalves on Tue Apr 24 08:29:29 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It was an hardware/human problem. I was reading the wrong pin, because I got confused with the markings on the processor. Three circles, but only one of them is the little one..... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 00:58:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Problem-setting-pin-P2-0-as-GPIO-in-LPC1768/m-p/565515#M18052</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T00:58:37Z</dc:date>
    </item>
  </channel>
</rss>

