PC interrupt handler
PC interrupt handler: The program and the circuit presented here are an introduction to practical interrupt handling in IBM PCs and compatibles, a subject fraught with pitfalls to the average PC user. The program (shown in the listing) is a memory-resident utility that monitors one of the PC’s interrupt request lines, IRQ2 through IRQ7. It produces a short beep on the PC’s loudspeaker when a request occurs. Interrupt requests may originate from insertion cards, and serve to inform the PC that a particular event has occurred that requires the action of a servicing routine, which interrupts the currently running program. Interrupts may be used to signal the activity of, for example, a telephone ringing circuit, a temperature monitor, a voltage level monitor or a watchdog. To help you understand the use and basic operation of interrupts, a simple circuit is given that generates an interrupt when a push-button is pressed. Taking good care to avoid conflicts with cards already installed in the PC, set the push-button interrupt line with the aid of a jumper, JP’ through JP6. In the program, this interrupt line should be defined accordingly by assigning the correct value to the constant ‘IRQ’ (see the listing).
When the push-button is pressed the TLC555 supplies a 100-ms long interrupt request pulse, which is transferred to the 8259 interrupt controller in the PC via an extension bus slot. Components R1 and C2 form a switch debouncing network. The circuit is readily built on the prototyping board for computer extensions described in Ref. 1.
At the end of the listing are two comment lines that serge to prevent the uninstall routine being called. If you intend to make changes to the program, we recommend that you do not attempt to make it resident straight away since the utility can then be removed from memory only by rebooting the computer. Therefore place the KEEP instruction in between braces, and temporarily add REPEAT UNTIL KEYPRESSED and UNINSTALL ‘INTERRUPT-HANDLER. This will save you a lot of time and trouble debugging your own application.
Reference:
1. ‘Prototyping board for computer extensions’. Elektor Electronics July/August 1988