OK, last time I might have confused you with 2-level interrupts. So here it is and please refer to the schematic. So here's how it works. In this diagram, you see 4 switches 2 rotary and 2 thumbwheel switches.  You will notice that each of the two rotary switches are inputs to 8 to 3 priority encoders and 8 input NAND gates aswell. And the Thumbwheel switches do not have them as they already have BCD outputs. So we can just use their raw outputs.  Also, the Thumbwheel switches are also inputs to 4 input NAND gates as well. That gives us our four interrupt levels which then goes into another 8 to 3 priority encoder which will give us the interrupt number. But I am getting ahead of you. So we use another 4 input NAND gate followed by an R/C network, for signal conditioning, and a Schmitt trigger which gives you a hard interrupt on your CPU. Basically for each of these interrupts, you only use one (1)  interrupt pin, but the downside it will take six (6) to seven (7) bitWrite instructions.  So these are the outputs:

  1. NA (000)  = Never should get this so it's pulled up. (default)
  2. Mode Switch  (001)    = 1 = ISR1
  3. Display Switch (010)  = 2 = ISR2
  4. Thumbwheel 1 (011)    = 3 = ISR3
  5. Thumbwheel 2 (100)   = 4 = ISR4                   

Please remember that this schematic will NOT work as is, as there are no Vcc or Grounds or pull up resistors etc.  

 

int ISR_A = 50;

int ISR_B = 49;

int ISR_C = 48

int DSw_A = 47;

int DSw_B = 46;

int DSw_C = 47;

 

int ISR = 19;                // ISR

int ISR_Rcv = 20;        // ISR Network Recvice

int ISR_Tx  =  21;        // ISR Network Transmit

int ISR_Dsp = 22;        // ISR Display Timer

int ISR_Kbd = 23;        // ISR Keyboard

int ISR_Dsp = 24;        // ISR Switches

int DisplaySw_Value = 0;

attachInterrupt (digitalPinToInterrupt (ISR), getDisplaySwitch, mode);

// INERRUPT SERVICE ROUTINE

void getISRnumber() {

    int ISR_Value = 0;

    int DisplaySw_Value = 0;

      biteWrite ( ISR_Value, 0, digitalRead ( ISR_A ));

      biteWrite ( ISR_Value, 1, digitalRead ( ISR_B ));

      biteWrite ( ISR_Value, 2, digitalRead ( ISR_C ));

      switch ( ISR_Value ) {

          case 1: {

               biteWrite ( DisplaySw_Value, 0, digitalRead (DSw_A ));

               biteWrite ( DisplaySw_Value, 1, digitalRead ( DSw_B ));

               biteWrite ( DisplaySw_Value, 2, digitalRead ( DSw_C ));

               break; }

          case 2: {

                getModeSwitch ();

                break; }

          case 3: {

                 getTWheelSwitch_1 ();

                 break; }

          case 4: {

                 getTWheelSwitch_1 ();

                 break; }

          default () { // Error To Be Determind.

                    }}