I am playing with interrupt mode 2 on a z80. Once pulled low it will disable interrupts and make a subroutine call to 0x0033. Before returning from the interrupt handler, interrupts should be explicitly activated through an opcode.


Say I have a manual, debounced switch that, once pressed, will cleanly trigger this interrupt. Say the routine takes 80 clock cycles to complete at 8Mhz, ie 10us total before the interrupt will be re-activated.

I assume the manual switch press will last longer than 10us. That means that several interrupts will be processed on a single key press. I would like to avoid that.

Some solutions could be:

  • don't use interrupts, silly, just do what everyone else does and just poll it.
  • in the interrupt routine, poll the switch and only return after the swithc is reset.

That's all fine.

It however would be cool if there was a way to use discrete components outside the cpu to ensure that only a single interrupt is issued.

One thing that comes to mind is an RC circuit with a very fast (10us) cutoff.

But are there other solutions?

  • 1
    \$\begingroup\$ you have a solution (RC), what's wrong with it? you can always find a more complicated solution, but that's true for anything. \$\endgroup\$ Jul 5, 2020 at 13:03

1 Answer 1


You could trigger a flip-flop with the debounced pushbutton, so that it only flags that it has been pushed by setting the interrupt pin low. Then in the interrupt routine, you could clear the flip-flop so it clears the interrupt state. The flip flop now goes to wait for getting triggered again with the pushbutton.

  • \$\begingroup\$ Trying to understand how that would work without the flip flop reverting to interrupt when S is still set beyond the falling edge of R. The wikipedia explanation of SR NOR gate hints at "To overcome the restricted combination, one can add gates to the inputs that would convert (S, R) = (1, 1) to one of the non-restricted combinations." Something like that? How would that look? \$\endgroup\$
    – lash
    Jul 5, 2020 at 16:52
  • \$\begingroup\$ By not using a SR flip-flop, but a D flip-flop with clock input. Pushbutton would drive the clock input, and CPU would drive the reset (or set) input depending on which way you want to permanently the D input. \$\endgroup\$
    – Justme
    Jul 5, 2020 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.