Question about the function call

96 views
Skip to first unread message

DSS Circuits

unread,
May 2, 2012, 4:05:21 PM5/2/12
to arduino-pinchangeint-discuss
Hey GreyGnome, great work on this I look forward to using this
library. I have a question about the function that is called when the
interrupt happens. Are interrupts disabled inside the function, like
a typical call to an ISR?

I need to use a pin change interrupt and the signal will probably
bounce a few times so I'm wondering if it will generate repeated
interrupts while servicing the function? I also might need to spend a
little time in the function so I need to know if time inside the
function is critical.

Thanks again.

Wayne

Michael Schwager

unread,
May 4, 2012, 10:19:01 AM5/4/12
to arduino-pincha...@googlegroups.com, way...@gmail.com
According to the ATmega328 datasheet,
When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are dis- abled. The user software can write logic one to the I-bit to enable nested interrupts. All enabled interrupts can then interrupt the current interrupt routine. The I-bit is automatically set when a Return from Interrupt instruction – RETI – is executed.

So yes, Interrupts are disabled by the chip itself.  Thus it will not generate repeated interrupts while servicing the function.

I'm not sure if you're asking me, but I'll tell you that time inside the function, from the perspective of the library, is not critical.  Whether it will cause problems to your sketch, or not, you'll have to be aware of as you create your project.

--
-Mike Schwager
Reply all
Reply to author
Forward
0 new messages