Content originally posted in LPCWare by asieg on Wed Jun 30 13:31:09 MST 2010
Hello everybody,
I just tried to readout the interrupt status from port 2 pin1 and I've trouble with it:
[LEFT][SIZE=2][COLOR=#3f7f5f][FONT=Arial][SIZE=2][COLOR=#3f7f5f]/* use port2_1 as input event, interrupt test. */[/COLOR][/SIZE][/FONT]
[/COLOR][/SIZE][SIZE=2][FONT=Arial]GPIOSetDir( PORT2, 1, 0 );[/FONT][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][FONT=Arial]/* port2_1, single trigger, active high. */[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE][SIZE=2][FONT=Arial]GPIOSetInterrupt( PORT2, 1, 1, 0, 0 );[/FONT][/SIZE]
[SIZE=2][FONT=Arial]GPIOIntEnable( PORT2, 1 );[/FONT][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]while[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial]( 1 )[/FONT][/SIZE]
[SIZE=2][FONT=Arial]{[/FONT][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial] ( GPIOIntStatus( PORT2, 1 )==1 )[/FONT][/SIZE]
[SIZE=2][FONT=Arial]{ i++;[/FONT][/SIZE]
[SIZE=2][FONT=Arial]GPIOIntClear( PORT2, 1 );[/FONT][/SIZE]
[SIZE=2][FONT=Arial]}[/FONT][/SIZE][/LEFT]
[SIZE=2][FONT=Arial]}[/FONT][/SIZE]
[SIZE=2][SIZE=3]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:[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]PORT2:[/SIZE]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ( LPC_GPIO2->MIS & (0x1<<bitPosi) )[/SIZE][/LEFT]
[SIZE=2]regVal = 1;[/SIZE]
[SIZE=2]
[SIZE=3]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.[/SIZE]
[SIZE=3]BUT if i pull the port2 pin 1 to GND before the debugger is on the line "[/SIZE][SIZE=2]case PORT2:" , [SIZE=3]for example I'm at the line "[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][FONT=Arial]if[/FONT][/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][FONT=Arial] ( GPIOIntStatus( PORT2, 1 )==1 )[/FONT][/SIZE][/SIZE]" [/SIZE][SIZE=3]in main() then the debugger crashes.[/SIZE]
[SIZE=3]Why???[/SIZE]
[/SIZE][/SIZE]
[/LEFT]