Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

External Interrupt in LPC1114

Status
Not open for further replies.

shanky07

Newbie level 5
Newbie level 5
Joined
Mar 29, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,378
Hello friends,

I am facing problem in external interrupt for lpc1114.
Here is my code =>


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
void PIOINT0_IRQHandler(void)
{
  uint32_t regVal;
    unsigned int i,j;
 
    gpioSetValue(0,2,0);
    for(i = 0 ;i < 500; i++)
        for(j = 0; j < 10000; j++);
  gpio0_counter++;
  regVal = gpioIntStatus(0, 1);
  if (regVal)
  {
    p0_1_counter++;
    gpioIntClear(0, 1);
  }     
  return;
}
 
int main(void)
{
    SystemCoreClockUpdate();
 
    gpioInit();                    //initialize gpio clock 
    gpioSetDir(0,1,0);        //set pin 0.1 as input
    gpioSetDir(0,2,1);       //set pin 0.2 as output
    GPIOSetInterrupt(0,1,0,0,1);  //set interrupt on pin 0.1
    gpioIntEnable(0,1);     //enable interrupt
    
    while(1);
}
void gpioInit(void)
{
  /* Enable AHB clock to the GPIO domain. */
    LPC_SYSCON->SYSAHBCLKCTRL |= SYSAHBCLKCTRL_GPIO;
  /* Set up NVIC when I/O pins are configured as external interrupts. */
  NVIC_EnableIRQ(EINT0_IRQn);
  return;
}
void gpioIntEnable(unsigned char portNum,unsigned char bitPos)
{
  switch (portNum)
  {
    case PORT0:
                LPC_GPIO0->IE |= (0x1<<bitPos); 
      break;
    case PORT1:
                LPC_GPIO1->IE |= (0x1<<bitPos); 
      break;
    case PORT2:
                LPC_GPIO2->IE |= (0x1<<bitPos);
      break;
    case PORT3:
                LPC_GPIO3->IE |= (0x1<<bitPos);
      break;
    default:
      break;
  }
  return;
}


While debugging above code in keil, after getting interrupt on pin 0.1 the ISR should get executed, but the code does not go in ISR. What wrong I am doing in this.
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top