I have a problem when employing InterruptIn on NXP LPC1768, using OS 6.2. Apparently invoking the .rise() method the program is stuck till first activation of the interrupt. The code below has revealed the problem. The program does not reach “second checkpoint” unless the switch connected to P18 is pushed once. Subsequently the program runs as expected.
Is this problem known to anybody else?
#include "mbed.h"
#include <cstdio>
InterruptIn bryter(p18);
volatile int telle=0;
void bryterkontroll(){
telle++;
}
int main(){
int tellehusk=0;
printf ("First checkpoint");
bryter.mode(PullDown);
bryter.rise(&bryterkontroll);
tellehusk=telle;
printf ("\n\r second checkpoint"); //second checkpoint
while (true) {
if(telle!=tellehusk) { // writes the number of clicks when changed
printf( "\n\r Number of clicks %d ",telle);
tellehusk=telle;
}
}
}