2010-09-22 11:19 PM
Usage of external interruptions (help needed)
2011-05-17 05:08 AM
Thanks a lot for an answer! Really full and clear.
2011-05-17 05:08 AM
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