lpcware

Interrupt not being implemented

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by brobson on Mon Aug 03 05:09:28 MST 2015
Hi all, I'm new to programming with the lpc systems so my problem might be something quite basic that I am not aware of.
I'm trying to get an interrupt to occur whenever a change happens on pio1_8 and have the following bits of code to do this:
(pin set up)
LPC_IOCON->PIO1_8 |=  0x11;//selects ct16b1_CAP0 and sets pull up resistor
(timer set up, in main.c)
LPC_SYSCON->SYSAHBCLKCTRL |=  0x00000180;// Enable CT16B0 & CT16B1 Clocks
LPC_TMR16B1->PC = 0x00000000;
LPC_TMR16B1->PR = 0x00000010;


LPC_TMR16B1->TCR |= 0x01;//ENABLES TIMER AND PRESCALER COUNTER
LPC_TMR16B1->CCR |= 0x04;//SETS INTERRUPT ON STATE CHANGE AT CT16B1_CAP0
LPC_TMR16B1->CTCR |= 0x0;//SELECTS COUNT INPUT AND FLAGS TO BE RAISED ON EITHER EDGE

NVIC_EnableIRQ(TIMER_16_1_IRQn);

(interrupt handler)
void TIMER16_1_IRQHandler (void)
{
int i;

i++;
LPC_GPIO2->DATA |= (0xFC0);
LPC_GPIO2->DATA &= (0xF3F);

LPC_GPIO3->DATA |= (0x03F);
LPC_GPIO3->DATA &= (~0xFC0);

LPC_TMR16B1->IR |= 0x10;//RESET FLAG
}

I have the pin set with a pull up resistor and I am connecting a ground wire to change it, however the software doesn't seem to be picking it up. Can anyone see something wrong with my code?

Outcomes