How to make use of Interrupts on pins 20 & 21 of a Mega when using an I2c LCD

Hi everyone,

I want to make use of all 6 interrupts on an Arduino Mega. The project uses an I2C LCD which uses SCL and SDA which I have wired to and the LCD works fine. I have wired separate inputs to pins 20 & 21 which I want to trigger a falling edge interrupt function. I'm using attach interrupt to digital pin for all interrupts and the ones triggered from pins 2, 3, 18, 19 work fine, however when I enable the interrupts for pins 20 & 21 (SDA & SCL) they continue to fire and stop the LCD.
Is there a way of isolating the interrupts from SDA & SCL from pins 20 & 21 so I can make use of these interrupts with the LCD working in I2C mode? I can add some code however I'm sure the question should be sufficient for those in the know. Thanks

Those pins are physically the same. There is NO way to separate them. You might consider pin change interrupts if you need more interrupts.

You can use Pin Change INTerrupt PCINT on any pin.

DrDiettrich:
You can use Pin Change INTerrupt PCINT on any pin.

Not true for the used Mega.

This shows the PCINT pins.

Thanks for the update. If not all so at least 24 pins are selectable for PCINT.

Always worthwhile asking - why would you wish to use interrupts? :roll_eyes:

Thank you