From http://arduino.cc/forum/index.php?topic=80928.0
From http://arduino.cc/forum/index.php?topic=80928.0
/* * Theory: all IO pins on Atmega168 are covered by Pin Change Interrupts. * The PCINT corresponding to the pin must be enabled and masked, and * an ISR routine provided. Since PCINTs are per port, not per pin, the ISR * must use some logic to actually implement a per-pin interrupt service. */ /* Pin to interrupt map: * D0-D7 = PCINT 16-23 = PCIR2 = PD = PCIE2 = pcmsk2 * D8-D13 = PCINT 0-5 = PCIR0 = PB = PCIE0 = pcmsk0 * A0-A5 (D14-D19) = PCINT 8-13 = PCIR1 = PC = PCIE1 = pcmsk1 */ Setup: PCMSK2 |= (1<<PCINT23); PCICR |= (1 << PCIE2); PCMSK0 |= (1<<PCINT0); PCICR |= (1 << PCIE0); ISR(PCINT2_vect) ISR(PCINT0_vect) { code here }