user7123: 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) &= ~(1<<digitalPinToPCICRbit(pin));

but it isn't working.

user10794: Don't you mean:
  PCICR  &= ~bit (digitalPinToPCICRbit(pin));


7123: <p>I am using the following code to enable an interrupt for a pin:</p>

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

<p>But I can't disable it. I am trying with this code:</p>

<pre><code>if (*digitalPinToPCMSK(pin) == 0)
*digitalPinToPCICR(pin) &amp;= ~(1&lt;&lt;digitalPinToPCICRbit(pin));
</code></pre>

<p>but it isn't working.</p>
 10794: <p>Don't you mean:</p>

<pre><code>  PCICR  &amp;= ~bit (digitalPinToPCICRbit(pin));
</code></pre>
