Classic Computer Magazine Archive COMPUTE! ISSUE 150 / MARCH 1993 / PAGE 84

Worlds of conflict. (hardware interrupt conflicts)
by Philip Chien

The more boards and software you add to your computer, the more likely it is that you'll experience interrupt conflict. Here's how to identify and resolve conflicts.

You've just added a new accessory to your computer, and suddenly something doesn't work anymore. Or a new device hooked up to an input/output (I/O) port doesn't seem to work properly. The source of your problem may be defective equipment or a bad cable, but it's more likely to be a hardware interrupt (IRQ) conflict. Interrupts are the way an I/O device such as your modem or your keyboard can tell your computer that it needs attention. If you have two devices set to the same hardware interrupt, they can conflict with each other, which can result in strange and often confusing error messages.

What's especially mystifying is that it's possible for an interrupt problem not to show up for a while. You can be using your computer for a long time without any problems, and then suddenly something strange happens, possibly because you're using a new program or an old program you haven't used for a while or because you've upgraded an existing program to a new version that uses interrupt-driven drivers.

The Polite Interrupt

While interrupts may be confusing they're extremely useful tools for your computer, especially when it's communicating with the outside world. For example, a send/receive fax/modem generates an interrupt when its phone line rings. Your computer's processor recognizes the interrupt, temporarily stops the program it's running, runs the fax subprogram to receive the fax message, and then continues the main program from where it was temporarily stopped. The entire process takes less time than it takes to read about it, and normally you won't notice any reduced performance in your program.

On the other hand, if your fax/modem's interrupt is incorrectly set, the modem may not be able to recognize incoming faxes unless you're running a fax program that doesn't require interrupts (for example, a menu-driven program that constantly monitors the phone line to detect incoming calls). The first time you notice that the card is incorrectly configured may be when you upgrade to a new operating system--or when you get calls from customers wondering why your fax machine isn't working.

Besides interrupts, most hardware devices have their own assigned I/O ports: memory locations assigned to transfer data between the computer and hardware device. Some cards have DMA (Direct Memory Access) channels with the ability to read and write to your computer's memory directly. As with IRQs, you should make sure you don't have more than one card set up to use the same location.

Hard Versus Soft

Another confusing factor is that there are several different types of interrupts. Programs can generate their own software interrupts, and they often use interrupts to call operating system routines.

TSRs (Terminate and Stay Resident programs) are examples of routines that use both hardware and software interrupts. Hitting the proper combination of keys causes a hardware keyboard interrupt. The TSR software uses a software interrupt to temporarily stop your current program and allocate memory space for the TSR routine until it's completed.

An Isolationist Policy

The simplest way to solve hardware interrupt problems is to avoid them in the first place. Whenever you install a new peripheral, write down the device's characteristics and configuration. As a general rule, I include a text file named WHO_AM_I.TXT on each computer I set up, documenting the computer's configuration and each of its peripherals and accessories. I tape a hardcopy of this documentation to the inside of the computer's case for future reference.

When installing a new device that uses an IRQ, you should check to see which IRQs are available. Table 1 shows the standard interrupt assignments for XT-class (8088) and AT-class (286, 386, and 486, machines. The device probably has a set of switches or jumpers to select different IRQs. You may also need to configure the device's software drivers to tell it which interrupt you've selected.

But what should you do if you unexpectedly encounter a hardware interrupt problem?

The first rule to remember is that interrupts have different priorities, with lower-numbered interrupts getting higher priorities. For example, if the keyboard (IRQ1) and primary printer (IRQ7) generate simultaneous interrupts, the keyboard gets priority. After it completes its routine, the printer interrupt can be processed. The second major point of confusion is the IRQ2 on an AT-class machine. There is no IRQ2 on an AT-class machine. Anything assigned to IRQ2 is automatically switched to IRQ9.

Internal modem and fax/modem cards are generally designed to emulate a standard serial port attached to a modem. Since they look like serial ports to your computer, they're configured as COM ports. You should remember that they must be assigned to an unused port within your system. Higher-quality internal modem cards can be configured as COM3 or COM4 to avoid conflicting with the standard COM1 and COM2 ports which may already be installed in your computer.

If you suspect an IRQ conflict, you should run a diagnostic program that displays each of the hardware interrupts and its status (table 2). If the diagnostic program crashes (stops working and refuses to accept any keyboard input), then it's likely that you have two devices set to the same IRQ.

The most obvious source of your IRQ conflict is the most recent change you've made to your computer (that is, a new hardware peripheral, a new device hooked up to your computer, a new program or driver, and so on). This may be misleading, though. I had accidentally configured my mouse and COM1 serial port to the same IRQ. Both the mouse and a modem hooked up to the COM1 serial port worked normally until I disconnected the modem and hooked up a scanner to the COM1 port. My scanner's software package indicated that it couldn't find the scanner attached to the serial port (a message that was particularly irritating, since the scanner was sitting right there on the desk next to the computer).

The solution didn't seem obvious until I checked the switch settings for the IRQs for the COM1 port and mouse and found that they were both set to IRQ4. Since IRQ4 is the standard location for the COM1 port (and also for the COM3 port, with IRQ3 being the standard location for the COM2 and COM4 ports), I reset the mouse card to another IRQ. My mouse card has a set of DIP switches to configure the card's address and IRQ, and fortunately, the card had enough documentation to permit easy reconfigurations. After the switch, the scanner software was able to find the serial port and scanner, and everything worked perfectly.

You may have to open up your computer to examine how its ports are configured. If you've never opened up your computer, you should have an expert help you. A small flashlight can be extremely useful for examining switch settings. In general, any ports built into your computer have their setting jumpers or switches on the motherboard, and peripherals have jumpers on their boards in the expansion bus. In some rare cases, settings are extremely difficult to establish and may require a knife or soldering iron, but almost all peripheral cards use standard switches and jumpers. Some cards include enough documentation printed directly on the board to indicate how the switches or jumpers should be set; others include cryptic labels like J5, and you have to refer to the documentation to determine how to set up the card properly.

Don't Give Up the Chip

Look for interrupt conflicts when you install new peripherals and software and whenever you have a degradation in performance for no obvious reason. Interrupt conflicts are far more common than other sources of computer problems, such as hardware failure or viruses, and are much more easily fixed.