2012-05-01 05:51 PM
if ( RisingEdge )
{...} else if ( FallingEdge ) { .... }}How can I do anything similar to this?Thank you for your time2012-05-02 07:36 AM
I think - naturally not.
The Ref. Manual says:Rising and falling edge triggers can be set for the same interrupt line. In this configuration, both generate a trigger condition. This is what you do. Within the interrupt, you just know a transition happened. You could poll the current state of the line that generated it. If you are not too late, it might have been the transition to this level.2014-05-23 02:23 PM
I have a similar problem, I used the IF inside the ''void EXTI0_IRQHandler(void)'' but it's not work, any idea?
void EXTI0_IRQHandler(void){ Delay_ms(10);//button PA0 stm32f4 discovery if(EXTI_GetITStatus(EXTI_Line0) != SET) { GPIO_ResetBits(GPIOD, GPIO_Pin_13); } else {GPIO_
SetBits(GPIOD, GPIO_Pin_13);
}/* Clear the EXTI line 0 pending bit */EXTI_ClearITPendingBit(EXTI_Line0);}2014-05-23 02:42 PM
a) You are testing an Interrupt status not a pin level
b) You are causing a race condition in the NVIC by placing the interrupt clearing as the last function, which will most likely cause immediate re-entry of the IRQ handler with the IT status as false.2014-05-23 03:12 PM
ok, the questions are:
a) if I'm reading the status of interrupt, mmm... then I would have to read a status pin level, for select if a rising edge or falling edge. is it correct?b) ok, then if I push the button, will the led turn on? and then will the led turn off? something like that. all that in one push of the button.2014-05-24 11:34 AM
''I would have to read a status pin level, for select if a rising edge or falling edge. is it correct?''
Yes.''then if I push the button''What button? The chip doesn't know about ''buttons'' - just the levels on its input pins.''will the led turn on?''What LED? Again, the chip doesn't know about ''LEDs'' - it just has output pins which can be set 'high' or 'low'2014-05-24 12:09 PM
thank you so much.
I learned much, including the aclaration about the chip.2014-05-24 03:34 PM
void EXTI0_IRQHandler(void)
{
if (EXTI_GetITStatus(EXTI_Line0) != RESET)
{
/* Clear the EXTI line 0 pending bit */
EXTI_ClearITPendingBit(EXTI_Line0);
if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0))
GPIO_ResetBits(GPIOD, GPIO_Pin_13);
else
GPIO_SetBits(GPIOD, GPIO_Pin_13);
}
}
2014-09-10 09:51 PM
I use
void EXTI0_IRQHandler(void){if(GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)) {
// falling } else {// rising }}2023-08-31 11:18 PM
you need to be sure there are not bounce in your inputs to do that