Interrupts on ATtiny1604 #634
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is no vector for individual pins. attachInterrupt( keeps a table of up to 8 function pointers for each port, and the interrupt that fires loops up to 8 times checking whether that pin triggered an interrupt. That is why, even after my total refactor of attachInterrupt, which reduced the overhead considerably (compare the tools -> attachInterrupt mode default option with the old implementation, note the difference in binary size.), they are still grindingly slow. Not only is there that loop, but because a function that cannot be inlined (because it's set at runtime) is called from within an ISR (that's something you should never do), it has to push every call-used register onto the stack (16 of them), and then pop them back off at the end: 1 clock per push, and 2 per pop |
Beta Was this translation helpful? Give feedback.
There is no vector for individual pins.
attachInterrupt( keeps a table of up to 8 function pointers for each port, and the interrupt that fires loops up to 8 times checking whether that pin triggered an interrupt. That is why, even after my total refactor of attachInterrupt, which reduced the overhead considerably (compare the tools -> attachInterrupt mode default option with the old implementation, note the difference in binary size.), they are still grindingly slow. Not only is there that loop, but because a function that cannot be inlined (because it's set at runtime) is called from within an ISR (that's something you should never do), it has to push every call-used register onto the s…