Adding a Hardware Interrupt

8085 Circuit image showing Interrupt Connections

We Interrupt This Program...


Interrupts are the breaking news reports of the software world. They stop the current program, take over for a while, then return you to the previously scheduled program. Unlike television, you don't miss anything from the program that was interrupted.

Adding an Interrupt Input

Interrupt Test Software

Now that we have hardware in place to put an interrupt signal on the TRAP line of the 8085 when we wish, we need software to do something with that interrupt.

The TRAP signal tells the 8085 to stop whatever it's doing, save its place, and execute the program starting at address 0x0024 (hexadecimal, in decimal this is location 36.) So now we'll program the RAM to have an additional program at that location.

When the 8085 starts up, it will execute the program that starts at location 0x0000. We'll leave our prior program there, the four-byte program from Add a Memory that turns on the SOD LED then stops. The fact that the program has stopped doesn't affect the 8085's ability to respond to a TRAP signal. In fact, some 8085 programs consist of nothing more than a few bytes that enable interrupts then stop. Everything the 8085 does is a result of the interrupt programs in those systems.

Here's our program. All numbers are in hexadecimal:

Memory Address   Byte    Operand
0000 3E MVI A, 0xC0
0001 CO
0002 30 SIM ; Turn on the LED
0003 76 HLT ; and stop.
0024 3E MVI A, 0x40
0025 40
0026 30 SIM ; Turn off LED
0027 AF XRA A ; Clear A
0028 47 MOV B,A; Copy to B
0029 3D DCR A ; Count down A
002A C2 JNZ 0029
002B 29
002C 00
002D 05 DCR B ; Count down B
002E C2 JNZ 0029
002F 29
0030 00
0031 3E MVI A, 0xC0; Turn on LED
0032 C0
0033 30
0034 C9 RET ; All done, go back.

This program will make the LED blink off for a short while, then it will come back on again until the TRAP key is pressed again. If you are running at a low speed, with a 2MHz crystal oscillator or lower, be patient, the LED will go off for quite a while before coming back on again.

If the program doesn't work, use your logic probe to make sure that the input to the TRAP line goes low when you press the key. If it does not, check your debounce circuit and your key. Look at my images to see if your wiring looks similar to mine for the key and debounce. Make sure that you are connected to TRAP, pin 6 on the 8085.

My image at the top of the page (click it for a close-up) shows the connection going to RST6.5--this won't work with this program. In the image I have a blue wire that leads to a buffered switch on the logic lab going to TRAP (and other blue wires going to RST7.5, RST5.5, and INTR.) If that doesn't fix it, check your program to make sure that it's correct.

<< Back to Add a Hardware Interrupt Part 1

Interrupt Page: 1  2

<< Mag-85 Home