cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of external interruptions (help needed)

morpeh89
Associate II
Posted on September 23, 2010 at 08:19

Usage of external interruptions (help needed)

2 REPLIES 2
morpeh89
Associate II
Posted on May 17, 2011 at 14:08

Thanks a lot for an answer! Really full and clear.

epassoni950
Associate II
Posted on May 17, 2011 at 14:08

Hello,

If you use interrupt, yes if your 4 interrupts are with equal priority, handler of one interrupt must finish before handler of another interrupt can begin. You can use for example EXTI Line 0 to EXTI Line 3 interrupt.

About speed :

I think first solution is better about speed. But with this solution your microcontroller can't do anything else. You must also notice that perhaps you should detect rising or falling edge to start a process. With your example, you detect only state of pin and not edge. For speed optimizing, if your 4 lines are on same port, it's better to read once IDR register and test 4 bits after than do 4 reads using bit banding.

For second solution, yes there is some time to start interrupt handler : finish current instruction, read interrupt vector, push registers on stack and the end pop registers from stack. You must notice that with NVIC, if a second interrupt is pending when first interrupt is finished, there is no pop then push registers but direct branch to another handler. The advantage of this solution is that your microcontroller can do another process in main loop. The second advantage is that EXTI controller can trig interrupt on rising or falling edge.

Best regards

Eric