5 years, 1 month ago.

InterruptIn usage with port 1 pins


If i use a port 1 pin as an interruptsource like

DigitalOut led (dp28); InterruptIn sw1 (dp17);

void test() { led = !led; }

int main() { sw1.rise(test); while(1) { wait(1.0); } }

The interrupt wont get fired. The code works fine when using a normal DigitalIn and polling in the while loop. I suspect the InterruptIn class, but code looks fine. Already tried the mode function to change to pulldown, but same result: led wont toggle. According to the datasheet it should be possible to generate an interrupt on these pins.

Any suggestions would be welcome.

Kind regards, Jan

Comment on this question

1 Answer

5 years, 1 month ago.

You are not the first one to run into that, see: and I also had a very short look at the code, and indeed it looks fine. But I don't have the LPC1114, so cannot investigate myself.

Something you can try, make an interruptin object, after that set the interrupt vector directly to your function (with NVIC_SetVector, just as in the InterruptIn source code for the LPC1114). If it does get fired, the interrupt handler is wrong, if it doesn't get fired, the setup is wrong. (If you do that and it gets fired continiously, then that is normal, since your user function won't set the bit to disable it afterwards).

Edit: Had another short look at it, see for something to try.

To post an answer, please log in.