Multiple inputs -> one interrupt (question)

Hi all,

I would like to know if this is possible and if so, how to do it....

I need to trigger ONE interrupt if ANY pin that I specify changes (i.e. goes low).

What I am trying to do is this: I've got a keyboard controller board (removed from an old PS/2 compatible keyboard). It has row inputs and column outputs.

Each column, one after the other, sends out a short low pulse, and if this pulse gets to a row input, a certain key is decoded.

So, when ANY column pulses low, I want it to fire the ISR which will, in turn, pulse a row pin (generating a "key press") which I will capture with serial input, store to an array, then when I have all of them I'll dump the array out the serial port to examine.

I could probably just poll the column pins... even if I miss one I'll get it the next time around.

The purpose is to figure out which row and column to use to generate a particular keystroke (ultimately to make a programmable macro generator).

Any ideas will be appreciated!

If you want keyboard macros, then use one of the Arduino variants which can act as a USB keyboard. (Unless your target doesn't have USB.) No need to reverse-engineer the PS/2 connection. Plus I think this may have already been done with an Arduino.

The AVR Arduinos can do pin-change interrupts where one 'port' of 8 pins generates one interrupt when any of them change. You can also register several different interrupts to go to one single function.

But if this is just a tool for testing and it doesn't have any other jobs to do at the same time as watching the pins, then polling will work.

With pin change interrupts the whole port shares one interrupt vector. There's one for each port. You could use those.

If every data line you want to test is a low signal, you can connect each of them to a diode, connect all the diodes and add a pullup, as shown in the attached picture.

D1 … D4 would generate an interrupt on being pulled low.
The leftmost pin would be ground.

If you have pins that should generate an interrupt on HIGH and if you don’t want to use more interrupt lines, you can add a transistor to invert the signal.

foo.png

foo.png

There is a pin-change interrupt library somewhere I recall… Definitely a problem for pin-change interrupts.