@Alex:
Example for pin 51 (not tested - your feedback would be welcome
)
1. From above interrupt table, you find out that pin51 uses 'PCINT2'.
2. Find out which pin change register 'PCIx' to use:
2.1 The Pin change interrupt 'PCI2' will trigger if any enabled PCINT23:16 pin toggles. PCINT23:16 pins are enabled individually by the PCMSK2 Register.
2.2 The Pin change interrupt 'PCI1' will trigger if any enabled PCINT15:8 pin toggles. PCINT15:8 pins are enabled individually by the PCMSK1 Register.
2.3 The Pin change interrupt 'PCI0' will trigger if any enabled PCINT7:0 pin toggles. PCINT7:0 pins are enabled individually by the PCMSK0 Register.
Code:
PCICR |= (1<<PCIE0); // enable pin change interrupt PCIE0
PCMSK0 |= (1<<PCINT2); // enable PCINT2 interrupt
4. Adjust interrupt routine name:
Corresponding interrupt routine must have the name 'PCINT0_vect' (because it's using 'PCI0')
Code:
ISR(PCINT0_vect){
boolean motorMowRpmState = digitalRead(pinMotorMowRpm);
etMotorMowRPMState(motorMowRpmState);
}