Detaching interrupts I am using the following code to enable an interrupt for a pin:

*digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin));  // enable pin
PCIFR  |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
PCICR  |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group


But I can't disable it. I am trying with this code:

if (*digitalPinToPCMSK(pin) == 0)
*digitalPinToPCICR(pin) &amp;= ~(1&lt;&lt;digitalPinToPCICRbit(pin));


but it isn't working.
Don't you mean:

  PCICR  &amp;= ~bit (digitalPinToPCICRbit(pin));