Electronic – arduino – What are the advantages or disadvantages that using internal interrupt instead of external interrupt in MCU

arduinointerrupts

in my project it seems I must using internal interrupt instead of external interrupt because my MCU run out of external interrupt pin. Here is an internal interrupt example I've found here.

I am quite curios about what kind of side-effects will the internal interrupt will bring to the entire system, is there any advantage/disadvantage?

Kind regards.

Best Answer

That depends on a lot of factors.

Internal interruptions usually are timer interruptions, so, if you want to keep track of time, using internal interrupts are a good idea.

Just don't trust them too much, Keeping track of time for long periods (ie: more than a day) is usually done better by a RTC.

External interruptions are good for dealing quickly with external world events. Such as new data on serial port, a sensor being activated/deactivated, voltage change on your ADC, etc...

In matter of fact, if you have to respond to events (and you will), the question one must make is not if you should use internal or external interrupts, but if you must use an interrupt at all to deal with that event, or if just polling the port with your state machine (and you should be using one for dealing with simultaneous tasks in embedded environment) will do the trick.

There are situations, of course, when using external interruptions is the only choice. If you are in deep sleep mode, the microcontroller will shut down all timers, all "uncesssary" hardware, and even the RAM memory (all your data will be wiped out), and run the CPU on the slowest clock available. The only way to wake up the microcontroller in most models using external interruptions.