AT COM3 OR COM4
                             HANG THE
                          GET CONFLICTS
                       ON THE COM1-4 PORTS
                     by Dr. W. Curtiss Priest
          Center for Information, Technology and Society
                      Lexington, MA  02173
                Internet: bmslib@mitvma.mit.edu
                      Voice: 617-862-7763
Most of us quickly have learned that while there are four COM
ports, there are only (usually) 2 IRQ's.  [In AT's you can also
use IRQ's 5,7, and 9, if your serial board supports those.]
First -- many uses of serial ports do not use interrupts and so you
can in those cases just forget about them.  Example:  you print
out a serial port using XON/XOFF hand-shaking using a redirection
program like LPTCOM1.
Second -- if you use only one IRQ, there is still no potential conflict
in terms of IRQ assignments.
Third -- if you want to use 2 IRQ's [3 and 4], you want one port to use
one of those and the other to use the other one.  Typically IRQ 4
is hardwired for use with COM1 and COM3, and IRQ 3 is hardwired for
use with COM2 and COM4.
So -- a typical configuration is:  your serial card is set for COM1
and COM2.  You use COM2 for your mouse (usually a DB 9 connector).
The mouse always uses interrupt servicing, and so your mouse driver
"hooks interrupt vector 3" and when an interrupt occurs the driver
services the request.
But now you add an internal modem.  Most telecommunications programs
like Procomm Plus use interrupt servicing of the modem.  So --
you must use the other IRQ, IRQ 4.  So, you set the modem to COM3, since
this usually sets the IRQ to 4 [newer boards allow mixing and matching
of IRQ's but the problem is always the same -- don't let two ports use
the same IRQ ! !
You find things still don't work.  Why?
The answer is in hardware, not in software.
When IBM designed the PC, they used an 8259 chip to service the
interrupt request.  On the bus there are separate lines for each IRQ.
On the XT there are 8 interrupts.  On the AT there are 16 (actually
15, since IRQ 9 is redirected to IRQ2)
An informative shareware program called IRQR produces the following
on my machine:
IRQR -- Report Status of 8259 Hardware Interrupt Channels
        Copyright 1988 by Lawrence R. Steeger
        8259  IRQ  Status   IBM Assignments  OEM Assignments
        ----  ---  ------   ---------------  ---------------
        0x21    0    used   Timer
                1    used   Keyboard
                2    used   2nd 8259         Autofax Imager
                3   >FREE   COM2
                4   >FREE   COM1
                5   >FREE   LPT2             MS Bus Mouse
                6    used   Floppy Disk
                7   >FREE   LPT1
        0xA1    8    used   Clock
                9    used   Redirected IRQ2
               10   >FREE   (reserved)
               11   >FREE   (reserved)
               12   >FREE   (reserved)
               13    used   Coprocessor
               14    used   Hard Disk
               15   >FREE   (reserved)
If you go into Procomm and shell to DOS and do this again, and if your
modem is on IRQ 4, you'll find the report changed to show IRQ 4
now used.  When you leave Procomm, Procomm releases the interrupt and
the report reverts back to showing FREE.
If you take a circuit diagram of a PC, you'll find each of the IRQ's
to correspond to actual bus pins [yes, the ones you plug cards into].
For example, you'll find IRQ 4 on Pins B24 and A24 [the only slot in
an XT and the slot nearest the back on an AT].  On an AT you'll find
for example, IRQ 14 (Hard Disk) on Pin D7.  This is in the second
slot from the back in the AT, and not present on the XT.
                            THE ANSWER
The 8279 watches all the IRQ lines (8 in an XT and 16 in an AT).
It recognizes an IRQ when the line goes from 0 volts to 5 volts.
It is also "edge triggered" -- the line only needs to go high long
enough for the 8279 to register the event on the rise of the square
Typical TTL:
In hardware things often are held high and pulled low.  This is commonly
done with a resistor to an output going to +5 volts and a transistor from
the output connecting the anode to the output and the emitter to ground.
A signal on the base causes the transistor to conduct, the output is
then pulled low.  This is very common in TTL (Transistor-Transistor Logic).
Boards sharing the same line will typically not "electrically" interfere
since the line is high across all of them using the pull-up resistor
and so any one board can pull the line low, regardless of the presence of
extra pull-up resistors (these resistors are typically ten thousand ohms
and a transistor can pull dozens of these in parallel low).
Atypical TTL:
But remember, IBM uses a chip that wants an output that goes low to high.
To achieve this the serial board designer uses a "totem pole driver."
Here there are two transistors. One to pull the line up, the other to pull
the line down.
Returning to software, you might think that if you don't ask the UART (the
Universal Asynchronous Receiver/Transmitter) chip to enable the interrupt
that the output on the IRQ line will be not present.  This would be
achieved with a "tri-state" output.  Tri-state is either low, high, or not
But this just isn't so.  Even if you haven't enabled the interrupt in
software, it still exists in the hardware.  So on that
serial port, a transistor is still trying to pull that IRQ line low.
So, if another board tries to pull it high using its transistor to +5,
there is a battle between the transistor on one board pulling the line
low and the other trying to pull it high.
The result is confusion.  Sometimes it works because the IRQ you want is
able to beat out the other port's transistor, and sometimes it doesn't
because it just can't compete.
                           THE SOLUTION
The solution is easy.  On boards that you are not going to use the
offending IRQ line, you disconnect that line from the bus.
There are two ways:
     1.)  For boards that are hardwired, you take a narrow strip of
     scotch tape and place it over the gold contacts that slide into
     the board.  To disable IRQ4 you wrap B24/A24 and to disable
     IRQ3 you wrap B25/A25.
     2.)  For boards that have jumpers for IRQ assignments, just
     take the jumper for the offending IRQ and remove it, or let
     it dangle from one pin into mid air.
Is this unbelievable?  Absolutely ! !
|               Dr. W. Curtiss Priest                                        |
|      Center for Information, Technology, & Society                         |
|                                                    *********************** |
|                  466 Pleasant Street               *  Improving Humanity  *|
     *  Through Technology * |
|                  Voice: 617-662-4044               *********************** |
|                   Fax: 617-662-6882                                        |