INT and PCINT - what's the difference?

In the last few month I've been digging into plain AVR code and Arduino-supported AVRs. Almost all modern AVRs have the term "PCINT[number]" on every pin, except for some old ones, like the ATmega16 and the ATmega128.

I've used the interrupt pins on an Arduino UNO a lot (D2 and D3), but the datasheet for the ATmega328p specifies that all the other IO pins got "PCINT" (pin change interrupt). I've read in AVR datasheets, and been googling a lot, but I haven't quite got it yet. Can someone please explain what the difference (or similarities) between INT and PCINT is? :slight_smile:

INT refers to the dedicated hardware interrupt pins. PCINT refers to the interrupts that can be generated by almost any of the I/O pins.
PCINT has more overhead in determining what pin caused the interrupt as a group of pins share the same PCINT vector (there are 3 PCINT vectors) so you need to determine what pin caused the interrupt withing the ISR before acting on it.
The INT pin is linked to a dedicated interrupt vector so you always know what pin caused the interrupt when in the ISR.

One big difference between INT and PCINT

PCINT: Any change on the pin trigger an interrupt

INT: It is possible to choose what kind of change trigger an interrupt.

Also, pcint can wake from sleep mode power down on change, int can only wake on low level.

Pcint is very good if you want to look at several pins at once - ex, it's very good for rotary encoders.

It's usually not too hard to work around not being able to set the type of transition that triggers it (though it can be)

Int has the attachInterrupt wrapper (which I consider an abomination, but which some people.prefer