STM8s903F3 _ Interrupt handler

Thread Starter

Prajeet Anand

Joined Aug 26, 2014
21
C:
while(1){

while(detect) // Interrupt on GPIO_D,PIN_3, RISE ONLY
    {
     delay_ms(10);
     status();
     detect = FALSE;
     break;
    }
  
  
   if(start) //Interrupt on GPIO_D, PIN _4, RISE ONLY
   {
   start = FALSE;
// do stuff

   }

}
interrupt handler - stm8s_it.c:
INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
//
  if((GPIOD->IDR & GPIO_PIN_4) !=0 ){
  
    start = TRUE;

  }

  if((GPIOD->IDR & GPIO_PIN_3) != 0 ){
  
    detect = TRUE;

    }

}
I'm using two pins from port assigned to two external interrupts( rise only). Whenever interrupt on GPIOD,PIN_4 is detected it executes the while(detect) which GPIOD,PIN_3 and then enters the if loop. These two interrupts are handled in INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6) . Please check the code below for reference.
 
Last edited:

Thread Starter

Prajeet Anand

Joined Aug 26, 2014
21
Is there a question here?
pardon my unclear explanation. the function inside "while(status)" which is "status();" is getting executed first and then it proceeds to call the function in the if(start). I don't know why its happening, even though the two interrupts are setup separately in the interrupt handler
 
Last edited:
Top