Using an Uno R3, I need 2 independent external interrupts. Using INT0 on pin 2 is fine, but I cannot use INT1 as I need to use pin 3 as my only option for a 25kHz fast-PWM output. I will therefore need to enable some other pin for a pin-change interrupt. Studying section 13 of the ATmega data sheet, I am not quite clear on any interdependence between external interrupts and pin-change interrupts. So far as I can tell, there isn't any, and I could, for example, use PCINT20 on pin 4, and this would work independently of INT0, even though the pins are all on PCI2. Is this correct?
I think that's right. My understanding is that even the two external interrupt pins can also be used as pin change interrupts. But remember that there's only one pin change interrupt flag bit per port, so if both of your pin change pins are on the same port, it won't be obvious which one has interrupted. Of course you could put them on different ports, and then you would know because each port has its own PC interrupt vector.
If you used pins 9 or 10 for your 25kHz PWM, then pins 2 and 3 would be free to use for your interrupts.
Thanks for the support. I have tried it and it worked fine. Just set two registers and add an ISR() function.
I tried PICINT8 on A0 and then PCINT20 on pin 4, which had been my original intention. The PCI remains independent of INT0 on pin 2 either way.
Good. That saves me having to mess with the PWM code, which is already working nicely on pin 3. And it turns out that having one of the interrupts on pin-change suits what I want to do.