This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

aamir hasan

Hello everybody,
I just tried to readout the interrupt status from port 2 pin1 and I've trouble with it:

/* use port2_1 as input event, interrupt test. */
GPIOSetDir( PORT2, 1, 0 );
/* port2_1, single trigger, active high. */
GPIOSetInterrupt( PORT2, 1, 1, 0, 0 );
GPIOIntEnable( PORT2, 1 );
while( 1 )
{ if ( GPIOIntStatus( PORT2, 1 )==1 )
{ i++;
GPIOIntClear( PORT2, 1 );
} }
I step to the line with "if" and when I don't pull the port 2 pin1 to GND the debugger goes to the function GPIOIntStatus. In this function I step to the line:

case

PORT2:

if ( LPC_GPIO2->MIS & (0x1<<bitPosi) )
regVal = 1;

and then pull the port 2 pin 1 to GND. Then the regVal is 1 and if I step back to the main my variable "i" will be increased.
BUT if i pull the port2 pin 1 to GND before the debugger is on the line "case PORT2:" , for example I'm at the line "if ( GPIOIntStatus( PORT2, 1 )==1 )" in main() then the debugger crashes.
Why???