Hi all
I've designed a circuit to allow an interrupt to be generated (via a latch) by pressing a push button
and then the /IRQ signal is cleared by writing to a particular address. (the 'clear interrupt pin address' if you like)
I'd welcome any comments as I would like to add it to a 6502 single board computer which I made.
Attached is a schematic and a description follows:
I've put active low signals prefixed with a slash e.g. /IRQ for the active low interrupt request.
Starting with IC5, this is a D-latch which latches the /IRQ after the push button is pressed. (R1 is just to have a pull-up rather than
directly tying signals to 5v)
The D input is permanently high as is the /preset input. The /preset input is permanently inactive (unused).
The AND gate IC4 ensures that IC5's Q output is LOW and therefore /Q is HIGH (i.e the latch is reset when the 6502 is reset.)
Therefore the /IRQ output will be high (inactive) after 6502 is reset.
Attachment:
int_handler.jpg [ 65.34 KiB | Viewed 872 times ]
If the pushbutton is pressed, IC5 is clocked (maybe a few times due to bounce), and the latch is then set - the Q output goes HIGH.
Therefore the /Q output goes low and the /IRQ output connected to this output now goes low.
Assuming the 6502 is correctly programmed to handle the interrupt, the ISR fires and in this ISR the code will then
be programmed to write to the address which is decoded in the schematic (the 'clear interrupt pin address' indicated by /Addr)
This asserts /Addr in the schematic, thus causing the input to inverter IC1 to go LOW.
When Phi2 goes HIGH, IC2 output will go LOW.
With the R/W signal LOW (i.e. write cycle) IC3 output will now go low, resetting the latch IC5, the the (IRQ) is not HIGH (deasserted).
when Phi2 goes LOW and the end of the cycle, IC3 output goes HIGH and IC4 output goes HIGH, so a pulse was generated to clear the latch (IC5)
and deasserting the /IRQ
Data for this write operation is ignored.
Some debounce may be needed - perhaps with a delay
Comments welcome
Regards
Russell