# How many and fast interrupt pin can handle in Uno?

So I am using Arduino UNO to do phase cutting and read Fan RPM.

For phase cutting, every half frequency it will triggers interrupts and then arduino will triggers TRIAC. Half frequency(50Hz) is 20ms. And for reading rpm, my fan running at 950rpm or 15.83rps, or doing a revolution for 63ms.

I think both of that works is doing a fast work, and I am afraid if I do it simultaneously the arduino will get an error(like a skip on one half wave, or a skip on reading one revolution), or will it not? Thanks.

• You are talking about tens of milliseconds, ages at the scale of the MCU. Unless you do silly things in the ISR, your Arduino should have no problem keeping with that pace. – Edgar Bonet May 27 '17 at 10:55
• If you are having problems (which is unlikely), you could use the RPM output as a clock input for timer1. That way the hardware wil count the revolutions for you. You can than add an interrupt for when the counter get to a certain value, and do some calculations based on that. That way you'd have a lot fewer interrupts. – Gerben May 27 '17 at 14:33

Let's do some math here.

UNO works at a 16 MHz clock rate. That's a clock cycle every 62.5 nanoseconds, or 16.000 cycles every millisecond. That means plenty of processing power within 20 millisecond, if used wisely (i.e., avoiding processing-intensive functions).

Conclusion: you shouldn't find any major problem if you do a good work with your code. Just keep things simple and don't go through the roof with what you intend to do each 20 ms.

You can find the number of external interrupt and pcint pins from the data sheet.

If you use interrupts, the overhead is about 20 or so ticks, or just over 1us. That gives you the minimum.

If polling, and you are lucky, 1 tick is all it takes. 1 /16th of a us.

If two interrupts happen at the same time they will both execute in the numerical order of their INT number (INT 0 will trigger before INT 1). But they will both execute - just one will be a little delayed.

If one interrupt occurs whilst the other is executing the second interrupt will trigger once the first has finished.

As long as both your interrupt routines combined take less than the time than the time between triggerings of the most rapid interrupt you won't get any issues.