Help with Interrupts for Rotary Encoders

Hi,
i'm working on a project on an Arduino Mega.
I have a lot of buttons and potentiometers connected to the board, and also TEN rotary encoders.
Buttons and rotarys are connected to the digital ins of Arduino passing thru 4021 shift reg. and potentiometers are passing thru 4051 mux.

I'm having performance problems with the rotarys, as i turn them fast they're not working properly.

I'd like to use the Interrupts of the arduino to make it work better.
My plan is to make a connection from the pin A to each rotary to one of the digital IN on the board that are made to work for interrupts:

"External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details."

So, since i have 10 rotarys and 6 interrups IN, my idea is to connect 2 rotary to each interrupt-in and when i start the ISR i focus only on the two relative rotary.

I made the connection (as i show on the drawing) but it doesn't work propery and fires the ISR all the time.

Here's the code i use for testing:

//*********//
Set up application
//*********//
void setup() {
  // Standard serial begin
  Serial.begin(9600);
  
 // Handling interrupts
  attachInterrupt(2, checkRotaryDeckA, CHANGE);
}

//*********//
Main Loop
//*********//
void loop() {
  Serial.println("NORMAL LOOP");
}

// INTERRUPT FUNCTION / ISR //
void checkRotaryDeckA()
{
  Serial.println("RECEIVING INTERRUPT");
}

I attach the image
Anyone can give me a hint on how i can do it?
Thanks in advance for yr help
g

image: http://lnx.giulioandreini.it/downloads/ROTARY-INTERRUPT-SCHMATICS.jpg

Arduino mega actually pins out 21 interrupts altogether (Pin-Change and External), but I don't think the attach/detachInterrupt routines are written to handle them.

However, you can write your own ISRs by referencing the Interrupt Vector definitions in iomxx4.h, and the Atmega1280 datasheet. You'll need to do some direct registry programming on the 1280 to setup and turn each of the interrupts on.

I haven't studied your setup but multiple encoder outputs on the same arduino inputs sounds like a logic nightmare. You'd be better to separate them.