AnsweredAssumed Answered

What's different  PCR[ISF] & ISFR in interrupt usage in GPIO mode ?

Question asked by kevin shang on Mar 16, 2014
Latest reply on Mar 18, 2014 by Kan_Li

Now I using 4 GPIOs ( PORTC 1,2,3,4 )  as keypads in a K20DX128VLF5, configuring them enter interrupt with falling edge,

when enter interrupt , we do flow code:

//----------------------------------------

void PORTC_ISR(void)

{

  if(PORT_PDD_GetPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_1)

            || (PORT_PDD_GetInterruptFlags(PORTC_BASE_PTR)&PORT_PDD_PIN_1)){

       PORT_PDD_ClearPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_1);

       PORT_PDD_ClearInterruptFlags(PORTC_BASE_PTR, PORT_PDD_PIN_1);

       KEY_1();

  }

  if(PORT_PDD_GetPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_2)

            || (PORT_PDD_GetInterruptFlags(PORTC_BASE_PTR)&PORT_PDD_PIN_2)){

       PORT_PDD_ClearPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_2);

       PORT_PDD_ClearInterruptFlags(PORTC_BASE_PTR, PORT_PDD_PIN_2);

       KEY_2();

  }

  if(PORT_PDD_GetPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_3)

            || (PORT_PDD_GetInterruptFlags(PORTC_BASE_PTR)&PORT_PDD_PIN_3)){

       PORT_PDD_ClearPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_3);

       PORT_PDD_ClearInterruptFlags(PORTC_BASE_PTR, PORT_PDD_PIN_3);

       KEY_3();

  }

  if(PORT_PDD_GetPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_4)

            || (PORT_PDD_GetInterruptFlags(PORTC_BASE_PTR)&PORT_PDD_PIN_4)){

       PORT_PDD_ClearPinInterruptFlag(PORTC_BASE_PTR, PORT_PDD_PIN_4);

       PORT_PDD_ClearInterruptFlags(PORTC_BASE_PTR, PORT_PDD_PIN_4);

       KEY_4();

  }

}

//--------------------------------

 

The problem is :

1 \ KEY_2 and KEY_4 cann't be detected , but the all out circuit are same( 10K pull-up, 0.1uf filter ).

2 \ Are we must to check both ISFR and PCR[ISR] to confirm the interrupt index?

3 \ As bove, are we must to clear both register bit when enter ISR routine ?

Outcomes