cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupts: Which Pin lauches the interrupt ?

contact
Associate
Posted on March 06, 2014 at 16:02

Hello,

I have 2 pins on the same port B defined to launch interrupt on RISE. When the interrupt is launched, how can I test which pin causes the interrupt launch ?

GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_IN_FL_IT);
GPIO_Init(GPIOB, GPIO_PIN_6, GPIO_MODE_IN_FL_IT);
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_RISE_ONLY);
INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
{
if
(rise_of_PB5) 
// how can I test if a rise of PB5 (and not PB6) launches the interrupt ???
{
//
}
if
(rise_of_PB6) 
// how can I test if a rise of PB6 (and not PB5) launches the interrupt ???
{
//
}
}

Thanks in advance #input-pin #interrupts #stm8
1 REPLY 1
tome
Associate II
Posted on October 31, 2014 at 19:37

Here an example

INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
{
data = GPIO_ReadInputData(GPIOB);
if((data == 0x10) || (data == 0x20)) //pin4, pin5
{ 
}
}