<?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: How to use external pin interrupts</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567295#M18816</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by emielzij on Mon Jan 26 04:18:16 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I took a look at the example. But I don't understand what is going on. I really prefer programing the registers directly. But I can't figure out which register I should use to check which pin caused an interrupt and how to clear the interrupt at the end of the ISR. Hope someone can help me with this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the LPC11C24&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: I think that the GPIOnMIS register should be checked to figure out which pin caused the interrupt. Would be nice if someone could confirm this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 23:47:20 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T23:47:20Z</dc:date>
    <item>
      <title>How to use external pin interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567293#M18814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by emielzij on Sun Jan 25 11:57:45 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to trigger an ISR if an external pin changes state.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code at the moment:&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;
#include "lpc11xx.h"

int main(void)
{
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1 &amp;lt;&amp;lt; 16);//Enable iocon clock

LPC_IOCON-&amp;gt;PIO0_1&amp;amp;= 0xFFFFFFF8;//PIO0_1 as standard GPIO

LPC_GPIO0-&amp;gt;DIR &amp;amp;= ~(1 &amp;lt;&amp;lt; 1);//PIO0_1 as input

LPC_GPIO0-&amp;gt;IS &amp;amp;= ~(1 &amp;lt;&amp;lt; 1);//PIO0_1 as edge sensitive

LPC_GPIO0-&amp;gt;IBE |= (1 &amp;lt;&amp;lt; 1);//Both edges trigger an interrupt

LPC_GPIO0-&amp;gt;IE|= (1 &amp;lt;&amp;lt; 1);//Not mask the interrupt of this pin anymore


NVIC_EnableIRQ(EINT0_IRQn);

&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {

&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}


void EINT0_IRQHandler(void)
{
//Check which pin triggered an interrupt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Some code
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Clear interrupt flag
}
&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 know that some statements are redundant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I check which pin is interrupted in the isr, is this the GPIOnRIS register?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And in which register do I need to clear the interrupt at the end of my ISR?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:47:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567293#M18814</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use external pin interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567294#M18815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Sun Jan 25 22:36:14 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What about LPCOpen sample&amp;nbsp; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like: nxp_lpcxpresso_11c24_periph_pinint&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:47:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567294#M18815</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use external pin interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567295#M18816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by emielzij on Mon Jan 26 04:18:16 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I took a look at the example. But I don't understand what is going on. I really prefer programing the registers directly. But I can't figure out which register I should use to check which pin caused an interrupt and how to clear the interrupt at the end of the ISR. Hope someone can help me with this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the LPC11C24&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: I think that the GPIOnMIS register should be checked to figure out which pin caused the interrupt. Would be nice if someone could confirm this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:47:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567295#M18816</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use external pin interrupts</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567296#M18817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Mon Jan 26 04:45:28 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: emielzij&lt;/STRONG&gt;&lt;BR /&gt;edit: I think that the GPIOnMIS register should be checked to figure out which pin caused the interrupt. Would be nice if someone could confirm this.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you are using masked interrupts? Otherwise I would recommend to read RAW interrupt status register&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CMSISv2p00 Sample:&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;
#include "LPC11xx.h"

volatile uint32_t counter=0;

#define INT_PIN(1&amp;lt;&amp;lt;0)//select pin of GPIO1

void PIN_init(void)
{
//Set ext interrupt
 LPC_IOCON-&amp;gt;R_PIO1_0 |= 0x01;&amp;nbsp;&amp;nbsp; //select GPIO
 LPC_GPIO1-&amp;gt;DIR &amp;amp;=~INT_PIN;//input
 LPC_GPIO1-&amp;gt;IS&amp;nbsp; &amp;amp;=~INT_PIN;//0: edge sensitive
 LPC_GPIO1-&amp;gt;IBE &amp;amp;=~INT_PIN;//0: trigger on IEV
 LPC_GPIO1-&amp;gt;IEV &amp;amp;=~INT_PIN;//0: trigger low interrupt
 LPC_GPIO1-&amp;gt;IE&amp;nbsp; |= INT_PIN;//1: enable interrupt
 NVIC_EnableIRQ(EINT1_IRQn);
}

//PIO1 interrupt handler
void PIOINT1_IRQHandler(void)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // PIOINT1
{
 if(LPC_GPIO1-&amp;gt;RIS &amp;amp; INT_PIN)//read raw interrupt status
 {
&amp;nbsp; counter ++;
&amp;nbsp; LPC_GPIO1-&amp;gt;IC |= INT_PIN;__NOP();__NOP();//clear edge detection
 }
}

int main(void)
{
 volatile static int i = 0;
 PIN_init();
 while(1)
 {
&amp;nbsp; i++ ;
 }
 return 0 ;
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:47:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/How-to-use-external-pin-interrupts/m-p/567296#M18817</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:47:21Z</dc:date>
    </item>
  </channel>
</rss>

