<?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: Interrupt lpc1343 in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579255#M24019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xOrElse on Fri Jul 06 20:51:13 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I added .zip file, there is my project. Also little notice for you, I changed some ports in program and on protoboard. Just telling...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P2.2 - button&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;P2.1 - LED&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On my protoboard LED (I tested it) and&amp;nbsp; trigger is connected like on this &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2F4.bp.blogspot.com%2F-scoXFGGR5qI%2FT_VL8_wbFTI%2FAAAAAAAAAMk%2F3GYHfmxStXk%2Fs1600%2FUntitled.jpg" rel="nofollow" target="_blank"&gt;scheme&lt;/A&gt;&lt;SPAN&gt;. 10k ohm resistor is set to be pull-down, and trigger goes to +5V.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I seriously hope that is the problem why mine program doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Also would you help me and tell me where do I change on what pin/port is interrupt?&amp;nbsp; I only saw that part of the code where I wrote: "I CHANGED ONLY THIS NEXT PART!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", in gpio.c file. But I think I change code partially.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Where can I find schemes for lpc1343? Not datasheets, I thought something like: how to connect led, trigger, simple projects just to find out does my (beginners) projects work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Where can I find something like library. I used to program in microBasic, and in Help there was list of all comands for lcd, timer etc. I haven't find it in lpcxpresso. Do I have to make it (.h and .c file-with funkcitons in it) every time I make projects?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I noticed that I can't use pin P0.10. Is that true? I connected 6 leds on P3.2, P3.1, P3.0, P0.6, P1.8, P0.10 and only one of them doesn't work, the one on P0.10 (I'm having &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2Fics.nxp.com%2Flpcxpresso%2F" rel="nofollow" target="_blank"&gt;this board&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:33:45 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:33:45Z</dc:date>
    <item>
      <title>Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579253#M24017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xOrElse on Thu Jul 05 04:19:59 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm havnig a little problem with interrupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://4.bp.blogspot.com/-scoXFGGR5qI/T_VL8_wbFTI/AAAAAAAAAMk/3GYHfmxStXk/s1600/Untitled.jpg&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this picture is how I connect all wires. Don't look the chip, it's just so you can see where is the button. In reality chip is: lpc1343.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This are all connections &lt;/SPAN&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://3.bp.blogspot.com/-QqWyBNYHbxY/T_VNMUDh6dI/AAAAAAAAAMs/bpmduXOdscI/s1600/P7050004.JPG&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;In this picture you can see one LED, it's just so I could see if the interrupt is working right. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The program is always in one loop while (1), where the led is OFF, and when I press the button the led should be ON, and it should be always ON. But it's not, like the chip doesn't recognize interrupt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LED is working perfectly, but I have problems whit this button, I'm not shure in the scheme anymore. (btw. that same scheme is working just fine on PIC18f456)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code for main program:&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;
int main (void)
{
&amp;nbsp; GPIOInit();

&amp;nbsp; /* use port0_1 as input event, interrupt test. */
&amp;nbsp; GPIOSetDir( PORT2, 4, 0 );
&amp;nbsp; GPIOSetDir( PORT2, 1, 1 );
&amp;nbsp; /* port0_1, single trigger, active high. */
&amp;nbsp; GPIOSetInterrupt( PORT2, 4, 0, 0, 0 );
&amp;nbsp; GPIOIntEnable( PORT2, 4 );

&amp;nbsp; while( 1 ){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIOSetValue( PORT2, 1, 0 );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (1){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (val!=0){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIOSetValue( PORT2, 1, 1 );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }}
&amp;nbsp; };
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;This is interrupt code:&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;
void PIOINT2_IRQHandler(void)
{
&amp;nbsp; uint32_t regVal;

&amp;nbsp; val=1;
&amp;nbsp; gpio2_counter++;
&amp;nbsp; regVal = GPIOIntStatus( PORT2, 0 );
&amp;nbsp; if ( regVal )
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; p2_1_counter++;
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIOIntClear( PORT2, 0 );
&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; return;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;val is global variable, so that I can use in all program...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything else is pretty much the same as their example on offical site...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me, I've been doing it for so long....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579253#M24017</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579254#M24018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by serge on Fri Jul 06 01:16:57 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;We need to see you complete program. Please export your program en post it here. Because now we don't know if you are using the internal pullups or pulldowns for example. These internal pullups or pulldowns can and will have an influence on the way your switch is behaving.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579254#M24018</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579255#M24019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xOrElse on Fri Jul 06 20:51:13 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I added .zip file, there is my project. Also little notice for you, I changed some ports in program and on protoboard. Just telling...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P2.2 - button&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;P2.1 - LED&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On my protoboard LED (I tested it) and&amp;nbsp; trigger is connected like on this &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2F4.bp.blogspot.com%2F-scoXFGGR5qI%2FT_VL8_wbFTI%2FAAAAAAAAAMk%2F3GYHfmxStXk%2Fs1600%2FUntitled.jpg" rel="nofollow" target="_blank"&gt;scheme&lt;/A&gt;&lt;SPAN&gt;. 10k ohm resistor is set to be pull-down, and trigger goes to +5V.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I seriously hope that is the problem why mine program doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Also would you help me and tell me where do I change on what pin/port is interrupt?&amp;nbsp; I only saw that part of the code where I wrote: "I CHANGED ONLY THIS NEXT PART!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", in gpio.c file. But I think I change code partially.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Where can I find schemes for lpc1343? Not datasheets, I thought something like: how to connect led, trigger, simple projects just to find out does my (beginners) projects work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Where can I find something like library. I used to program in microBasic, and in Help there was list of all comands for lcd, timer etc. I haven't find it in lpcxpresso. Do I have to make it (.h and .c file-with funkcitons in it) every time I make projects?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I noticed that I can't use pin P0.10. Is that true? I connected 6 leds on P3.2, P3.1, P3.0, P0.6, P1.8, P0.10 and only one of them doesn't work, the one on P0.10 (I'm having &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fhttp%3A%2F%2Fics.nxp.com%2Flpcxpresso%2F" rel="nofollow" target="_blank"&gt;this board&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579255#M24019</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579256#M24020</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 Fri Jul 06 22:54:04 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;#1 You've excluded your interrupt code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;//#define GPIO_GENERIC_INTS 1&lt;BR /&gt;&lt;BR /&gt;#ifdef GPIO_GENERIC_INTS&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;If code is grayed out that means that it's excluded via #ifdef :eek:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;change that to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;#define GPIO_GENERIC_INTS 1&lt;BR /&gt;&lt;BR /&gt;#ifdef GPIO_GENERIC_INTS&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;#2 Use volatiles in interrupts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
volatile uint32_t val=0; //this variable is added by me and corrected by ZERO
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt;#3 Learn to use breakpoints with your debugger. Debugger is your friend &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; See: &lt;/SPAN&gt;&lt;A href="http://" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.youtube.com/watch?v=E6vSPloei-0&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579256#M24020</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579257#M24021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xOrElse on Sat Jul 07 02:31:03 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Zero&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;#2 Use volatiles in interrupts:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
volatile uint32_t val=0; //this variable is added by me and corrected by ZERO
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I remove "//" signs in gpio.c&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; and change int to &lt;/SPAN&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;volatile uint32_t val=0;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN&gt; in gpiotest.c nothing changes, now it's even worse, it won't built!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you tell me where to put that declaration? I'm new at that field and new in lpc xpresso...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: I succeeded&amp;nbsp; in turning on the led (I did it by adding one while loop in interrupt function just to check if my program and hardwere really works), but only problem is to "transfer" value of the variable val into the main program. I don't know how to make that variable global. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In school we learned that any variable we want to make global we have to put it before main function. But we didn't make programs of few files (like header, and few .c files), so it's pretty new to me. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you please tell me how to make that variable global and explain what does volatile stands for?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also could you tell me something more about interrupts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If I have 3 buttons on PORT 0, where can I check which button made an interrupt?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you soo much on every help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579257#M24021</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579258#M24022</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 Sat Jul 07 02:46:49 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;...in gpiotest.c nothing changes, now it's even worse, it won't built!&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt;No, that's good :) Now Interrupt handler code is compiled and compiler is showing your errors to help you :):)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wiki is your friend: &lt;/SPAN&gt;&lt;A href="http://"&gt;http://en.wikipedia.org/wiki/Volatile_variable&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;In computer programming, particularly in the C, C++, C#, and Java programming languages, a variable or object declared with the volatile keyword usually has special properties related to optimization and/or threading. Generally speaking, the volatile keyword is intended to prevent the compiler from applying any optimizations on the code that assume values of variables cannot change "on their own."&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579258#M24022</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt lpc1343</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579259#M24023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xOrElse on Wed Jul 11 06:14:05 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have few problems with my lpcxpresso board and debugger actually I don't know where is problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;
#ifdef __USE_CMSIS
#include "LPC13xx.h"
#endif

#include &amp;lt;cr_section_macros.h&amp;gt;
#include &amp;lt;NXP/crp.h&amp;gt;

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

// TODO: insert other include files here
#include "gpio.h"
// TODO: insert other definitions and declarations here
volatile unsigned int v=0;
int main(void) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile unsigned int tipka;

&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIOInit();

&amp;nbsp;&amp;nbsp;&amp;nbsp; //set interrupt P2.2 - red button
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;DIR &amp;amp;= ~(0x4); //direction is input - button
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;IS &amp;amp;= ~(0x4); //level sensitive
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;IBE &amp;amp;= ~(0x4); //controlled by register IEV (not sure I did it correctly??)
&amp;nbsp;&amp;nbsp;&amp;nbsp; //LPC_GPIO2-&amp;gt;IEV |= 0x4; //when I push the button then it's recognized
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;IE |= (0x4); //!!!!!!

&amp;nbsp;&amp;nbsp;&amp;nbsp; //led
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;DIR |= 0x2; // led had direction to be output
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;DATA |= 0x2; //led is on
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO3-&amp;gt;DIR |= 0x1; // led had direction to be output
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO3-&amp;gt;DATA |= 0x1; //led is on

&amp;nbsp;&amp;nbsp;&amp;nbsp; //loop
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;DATA &amp;amp;= ~(0x2); // led is off
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((tipka=LPC_GPIO2-&amp;gt;MIS) &amp;amp; 0x4){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_GPIO2-&amp;gt;DATA |= 0x2; //led is on only if there was interrupt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Okay so here is the code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- P2.1- led&amp;nbsp; that is on pics turned off&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- P2.2-blue trigger&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Red trigger in on reset pin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- P3.0-led that is turned on on pics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Program should do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;P3.0 should be always on (as it is-that part of the program is working), when I press the blue button p2.1 led should be on and always on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I explained everything, here is my problem. I started to use program debugger and I test every line, few times I click in first while loop and variable tipka is 0 (this should be) after that I press the blue button and variable tipka is 0x4, this is also ok and the led is on after that. Well in debugger mode it works exactly as it suppose to be working. But when I unplug usb cable from PC and plug it again in PC (just to get power supply for board and chip) program in chip lpc1343 doesn't work!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really don't know where I'm wrong! Please help me! I've been working on that simple program for so long, and worst of all I have no idea where I'm wrong...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:33:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Interrupt-lpc1343/m-p/579259#M24023</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:33:47Z</dc:date>
    </item>
  </channel>
</rss>

