Connecting two open-collector INT outputs to one Interrupt

I have two open-collector outputs, one from a PS2 keyboard and one from a DS3231 Real Time Clock.

I am, successfully, throwing an arduino ATMEGA1884p into sleep mode with a set_sleep_mode(SLEEP_MODE_PWR_DOWN);

However, I would like to raise it out of sleep mode by, either, pressing on the Ps-2 keyboard OR if the alarm 1 on the Real Time Clock goes off. Both seem to be an open collector output that is high, and is going to a low on interrupt (but I don't know if the keyboard already has a 5V pullup resistor on that line inside the keyboard).

Both intertupts are being called with a FALLING flag, such as the one in the PS2Keyboard.cpp file where it is calling: attachInterrupt(irq_num, ps2interrupt, FALLING);

I need to connect the SQW pin and the IRQ pin of the PS2 in some way in order that I get a Wired-OR condition (not an AND condition).

I would like to not use an OR gate.

I know I should be able to do such a thing by properly manipulating the interrupt to trigger on the RISING rather than the FALLING edge; and by using diodes in one of the two possible polarities tied to the interrupt on pin 2 (possibly using negative logic in some fashion, because a negative logic Wired-AND might do it).

If I connect the PS-2 Interrupt through a diode with the diode's line end towards the keyboard, it still works fine.

Anybody know what the right thing to do in such a case would be in order that both outputs properly trigger the Interrupt without using a logic gate?

Possibly the use of a pull-down resistor, turning off the pull up resistor on that INTERRUPT pin and putting it through diodes with the opposite polarity?

I have some 1N914 diodes to experiment with.

Open collector or drain outputs are designed for the possibility of wired-OR logic. Just connect them together, with a pullup resistor and connect to an INT pin. Connect all the grounds, of course.

Why do you want to use an interrupt, if you have to check in code which device triggered the interrupt? You need at least as many inputs as you have interrupt sources.

If ever, I'd use a PCINT (Pin Change), where up to 8 interrupts can be watched in one ISR, and the interrupt source(s) can be determined immediately.

You better should try to understand how electronic circuits work, instead of playing with arbitrary solutions for not understood problems…

Investigate reply #1 carefully. You don't need any hardware beyond a pullup resistor for this.

Hi,
Truth Table, two NPN open collector.


Tom.. :slight_smile:

DrDiettrich:
Why do you want to use an interrupt, if you have to check in code which device triggered the interrupt? You need at least as many inputs as you have interrupt sources.

If ever, I’d use a PCINT (Pin Change), where up to 8 interrupts can be watched in one ISR, and the interrupt source(s) can be determined immediately.

Thanks for your help.